You need to sign in to do that
Don't have an account?
Chun Ming Kong
Lightning component namespaces: force, ui, lightnting
From the developer guide, force, ui and lightning namespaces are referring to:
I understand that lightning namespace is preferred when compared to ui namespace. But I am confused of the difference between force and lightning namespaces. For example, we can use force:inputField and lightning:input to show an input box.
Please suggest the possible use cases for these three namespaces.
force
Provides components for field- and record-specific implementations.
lightning
Provides components with Lightning Design System styling. For components in this namespace that are used in standalone Lightning apps, extend force:slds to implement Lightning Design System styling. In instances where there are matching ui and lightning namespace components, we recommend that you use the lightning namespace component. The lightning namespace components are optimized for common use cases. Event handling for lightning namespace components follows standard HTML practices and are simpler than that for the ui namespace components. For more information, see Event Handling in Base Lightning Components.
ui
Provides an older implementation of user interface components that don’t match the look and feel of Lightning Experience and the Salesforce mobile app. Components in this namespace support multiple styling mechanism, and are usually more complex.
(https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref.htm)
Provides components for field- and record-specific implementations.
lightning
Provides components with Lightning Design System styling. For components in this namespace that are used in standalone Lightning apps, extend force:slds to implement Lightning Design System styling. In instances where there are matching ui and lightning namespace components, we recommend that you use the lightning namespace component. The lightning namespace components are optimized for common use cases. Event handling for lightning namespace components follows standard HTML practices and are simpler than that for the ui namespace components. For more information, see Event Handling in Base Lightning Components.
ui
Provides an older implementation of user interface components that don’t match the look and feel of Lightning Experience and the Salesforce mobile app. Components in this namespace support multiple styling mechanism, and are usually more complex.
(https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref.htm)
I understand that lightning namespace is preferred when compared to ui namespace. But I am confused of the difference between force and lightning namespaces. For example, we can use force:inputField and lightning:input to show an input box.
Please suggest the possible use cases for these three namespaces.
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_force_inputField.htm
This component doesnt use the lightning style, but it automatically display the input field based on the type of the associated field:
Represents an input field that corresponds to a field on a Salesforce object. This component respects the attributes of the associated field
But for lighning:
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_lightning_input.htm
You have to define what is the data type you want to display. So it is not bound to a field of an salesforce object.
Conclusion:
To build a lightning component I would prefer to use lightning namespace if possible, since the lightning style is already applied. And since for both solution you would have to implement the logic to read ad save the data in the controller, I see no advantage of using the force namespace.