Component attributes are like member variable in Apex class. Attribute enables you to make component more dynamic.
Use the tag to add an attribute to the component or app.
All tag must have name and type values.
Supported aura:attribute types –
- Basic Types
- Boolean
- Date
- DateTime
- Decimal
- Double
- Integer
- Long
- String
- Function Type
- Object Type [Standard and Custom Object type]
- Collection Type
- Array – An array of item of a defined type
- List – An ordered collection of items
- Map – Key-value pair. A map can’t contain duplicate keys.
- Set – An unordered collection, Contains no duplicate elements
- Custom Apex Type
- Framework specific type
- Aura.Component
- Aura.Component[]
- Aura.Action
Interview Questions –
- What are the different type of aura:attributes type you can use in lightning ?
- Can you use sObject type in lightning component attribute ?