Monday, September 3, 2018

First Lightning Component

First Lightning Component:

Salesforce lightning include "lightning component framework" by which we can build 
responsive application for any device such as desktop,mobile which runs in lightning experience.Lightning component framework is a UI framework .Lightning component framework uses JavaScript on client side and apex on server side.Lightning component framework is built on Aura framework which help you built applications independent of your data in Salesforce.

When you build lightning component you deal with the following component bundles,


  • Component
Components contains markup .
  • Controller
Controller is used to handle events in components.
  • Helper
Contains method to handle logic.
  • Style
Contains style for the component.
  • Documentation
Documentation includes description and example to demonstrate the use of component.
  • Renderer
Contains default rendering behavior for component, We can override this by custom renderer.
  • SVG
It is a  custom icon resource for components that get displayed before the component name in lightning app builder or community builder.
  • Design
By using design:attribute under Design we can make a attribute available in tool such as App builder so that Admin can edit it.
  • App
App is used to run the component.


STEPS to build your first lightning component:

1)open Developer console.

2)Click File>New>Lightning component
3)Give Name,Description to lightning component.(Name=Firstlightningcomponent)
Now,
4)Under Component type below and click save.


<aura:Component>     // This is component tag.

Hi,Display this text.    // Any text you want to display

</aura:Component>

5)To preview the above component,We need lightning application.

Click File>New>Lightning Application.


Type:

<aura:application>
<c:Firstlightningcomponent>       // Name of Lightning component
</c:Firstlightningcomponent>
</aura:application>


Now,Click on preview on button.


Lightning component






















So,Your first lightning component is ready.

**************************************************************************************************************

TAGS:First Lightning Component,Lightning Component Framework,Build your first lightning component,salesforce components,lightning component,lightning component salesforce.

**************************************************************************************************************

No comments:

Post a Comment