You need to sign in to do that
Don't have an account?
Ishan K Sharma
Lightning Form Does not Display Lightning Experience
Hi,
Below is a simple example of lightnng form but it is not showing lightning experience. CSS is not working. Do i need to call Lightning CSS style sheet all the time in every lightning component? Or i am missing something else ?
<aura:component>
<div class="slds-p-bottom_large slds-p-left_large" style="width:500px">
<lightning:recordEditForm aura:id="recordViewForm"
recordId="0036F00002mr8eC"
objectApiName="Contact">
<lightning:messages />
<lightning:inputField fieldName="FirstName" />
<lightning:inputField fieldName="LastName" />
<lightning:inputField fieldName="Birthdate" />
<lightning:inputField fieldName="Phone" />
<!--Picklist-->
<lightning:inputField fieldName="Level__c" />
<lightning:button aura:id="submit" type="submit" label="Update record" class="slds-m-top_medium" />
</lightning:recordEditForm>
</div>
</aura:component>
Below is a simple example of lightnng form but it is not showing lightning experience. CSS is not working. Do i need to call Lightning CSS style sheet all the time in every lightning component? Or i am missing something else ?
<aura:component>
<div class="slds-p-bottom_large slds-p-left_large" style="width:500px">
<lightning:recordEditForm aura:id="recordViewForm"
recordId="0036F00002mr8eC"
objectApiName="Contact">
<lightning:messages />
<lightning:inputField fieldName="FirstName" />
<lightning:inputField fieldName="LastName" />
<lightning:inputField fieldName="Birthdate" />
<lightning:inputField fieldName="Phone" />
<!--Picklist-->
<lightning:inputField fieldName="Level__c" />
<lightning:button aura:id="submit" type="submit" label="Update record" class="slds-m-top_medium" />
</lightning:recordEditForm>
</div>
</aura:component>
Hi Ishan,
Sorry for this issue you are facing.
Style sheets can be created in different ways.
You can create a style sheet which works specifically for one component and also you can create a stylesheet which you can use across multiple lightning components and applications.
If you need to use your style sheet to multiple lightning components or lighting application, then it’s always recommended to define a common style sheet in a separate file with extension as .css. Upload this external CSS file as a static resource and it will be included in Lightning component using
<ltng:require styles=”{! $Resource.staticResourceFileName}”/> tag.
Sample CSS file is below:
demoCss.css (external CSS file):
YourComponent.cmp:
For more information on using style sheets in different ways, I would suggest you please refer to below blog post which is really helpful.- http://sfdcmonkey.com/2017/02/06/use-css-lightning-component/
Hope this helps.Kindly mark this as solved if the reply was helpful so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.
Thanks,
Nagendra