Aura component framework and attributes

Aura Component Framework and Attributes | All You Need to Know

What is the Lightning Component?

A UI framework called component framework is used to create single page applications for desktop and mobile platforms. On the client side, JavaScript is used, and on the server, Apex. Compared to many other frameworks, the Lightning Component Framework makes it much simpler to design programs that function on both mobile and desktop devices. 

Lightning comes with the Lightning Component Framework and a number of innovative developer tools. Lightning makes it simpler to create applications that are responsive across all devices. 

Both the Lightning Web Components paradigm and the classic Aura Components model can be used to create Lightning components. 

Where we use lightning component in Salesforce org

  • Lightning app builder
  • Community builder
  • Lightning pages
  • Lightning experience record pages
  • Quick action

dont miss out iconDon't forget to check out: Use Aura Component in Screen Flow | Salesforce Flow Builder Tutorial

What are the Lightning Component Attributes?

Attribute in lightning component is like a variable and it stores the different type of value.

Syntax:

<aura:attribute name="Anyname" type ="string" description="some description"  default="some default string"/>

A parameter of an attribute, the most important one, is its name and type, and another parameter where we can specify an attribute's description is its description. The parameter description is not necessary. In a similar vein, we have a default parameter that provides an attribute with a default value. We have an access parameter that allows us to choose public, private, or global access for an attribute when setting its access. The attribute is open to the public by default. 

We have a required parameter that we can set to true or false to make an attribute compulsory. 

  • Boolean

Syntax: 

<aura:attribute name="xyz" type="Boolean" />

We use the Boolean attribute when we want to store boolean values. 

  • Integer 

Syntax: 

<aura:attribute name="xyz" type="Integer" />

We use integer attribute when we want to store integer value. 

  • String

Syntax: 

<aura:attribute name="xyz" type="String" />

We use string attribute when we want to store string value.

dont miss out iconCheck out another amazing blog by Narendra Kumar here: What are Decorators in a Lightning Web Component?

  • Date

Syntax: 

<aura:attribute name="xyz" type="Date" />

We use date attribute when we want to store date value.

  • DateTime

Syntax: 

<aura:attribute name="xyz" type="DateTime" />

We use datetime attribute when we want to store datetime value.

  • Double 

Syntax: 

<aura:attribute name="xyz" type="Double" />

We use double attribute when we want to store double value.

  • Decimal

Syntax: 

<aura:attribute name="xyz" type="Decimal" />

Decimal is better than Double for maintaining precision for floating-point calculations. It’s preferable for currency fields. 

  • Long

Syntax: 

<aura:attribute name="xyz" type="Long" />

Long values can contain numbers with no fractional portion. Use this data type when you need a range of values wider than those provided by Integer. 

Responses

Popular Salesforce Blogs