Lightning Styling - Component Not Rendering with Default Style [duplicate]

595    Asked by CarlPaige in Salesforce , Asked on Jul 12, 2021

Just getting my feet wet in lightning. I am trying to render the following lightning app in Salesforce classic. However the form displayed is returned only in basic HTML (without the default lightning styling). Is it required that lightning be enabled to render lightning components? I would think not since the lightning components can be rendered on visualforce pages. Do I need to include any additional markup to render correctly? appName.app myfirstComponent.cmp: Basic Input Text

Advanced Input Text
Live Input Text
FirstName: {! v.firstName }

What is being displayed on preview:

enter image description hereTop keywords - lightning style

Answered by Carl Paige

Unlike in the flexi pages (Lightning app builder pages) when you use components in an app, Your app needs to extend force:slds. Using the Salesforce Lightning style in Apps The Salesforce Lightning Design System (SLDS) provides a look and feel that’s consistent with Lightning Experience. Use Lightning styles to give your custom stand-alone Lightning applications a UI that is consistent with Salesforce, without having to reverse-engineer our styles. Your application automatically gets Lightning Design System styles and design tokens if it extends force:slds. This method is the easiest way to stay up to date and consistent with Lightning Design System enhancements




Your Answer

Interviews

Parent Categories