Usage of force:inputField and Its working

Usage of force inputField and Its working

force:inputField component is used to display fields of a particular sObject with the appropriate type.  In other words, we don’t have to explicitly specify the type of the field. The component automatically renders the type.

For example: If the type of the field is date, then displays the Data Picker. Similarly if it is picklist, then a dropdown appears.

Consider the following code of force:inputField :
Component Code
Controller Code
Apex Code


  • In the above component, we used this with value attribute only. The component renders the type as text input for LastName, and picklist for the CleanStatus field.
  • This component doesn’t use the lightning Design System styling. Use lightning:input if you want an input field that inherits the Lightning Design System styling.

Try demo:

For more details refer to

Back to list

Leave a Reply

Your email address will not be published. Required fields are marked *