I want to show default value as 0.0 in lightning:input field on page load.

I don't want it to be a placeholder.

  • 3
    What you have tried so far? – rahul gawale Dec 30 '19 at 12:24

According to SF documentation, it is possible to be done without placeholder, just put default value in value field:

<lightning:input type="number" name="input2" label="Number field with a predefined value" value="0.0"/>
| improve this answer | |

Check out this playground to get an sample example of Number field with a predefined value in Lightning Web Component.

enter image description here

value property of lightning-input component specifies the value of an input element.

Reference:- Lightning Web Component Input

if you are dealing with Lightning Data service and want to pre-populate the field value of lightning-input-field, You can again use the value property of it to pre-populate.

            <lightning-input-field field-name="NumberField__c" value="0.0">
            <lightning-button type="submit"
                        label="Update record"
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.