
What are Aura Components in Salesforce? | The Ultimate Guide
The Lightning Component framework may be a UI framework for developing web apps for mobile and desktop devices. It’s a contemporary framework for building single-page applications with dynamic, responsive user interfaces for Lightning Platform apps. It uses JavaScript on the client side and Apex on the server side.Â
“The Lightning Component framework is a framework for developing web apps.”Â
Creating and Editing Aura Components
- Select File | New | Lightning Component to create an Aura component.Â
- In the New Lightning Bundle panel, enter helloWorld for the component name.
- Click Submit
Your component markup should look like the following:Â
What is a Component?Â
A component is a bundle that includes a definition resource, written in markup, and may include additional, optional resources like a controller, stylesheet, and so on.Â
A resource is sort of like a file but stored in Salesforce rather than on a file system.Â
There are the opening and closing <aura:component> tags, with some static HTML in between. Â
A bundle is sort of like a folder. It groups the related resources into a single component. Resources in a bundle are auto-wired together via a naming scheme for each resource type. Auto-wiring just means that a component definition can reference its controller, helper, etc., and those resources can reference the component definition. They are hooked up to each other (mostly) automatically.
Don't forget to check out:Â Use Aura Component in Screen Flow | Salesforce Flow Builder Tutorial
What is an App?Â
- An app uses <aura:application> tags instead of <aura:component> tags.Â
- Only an app has a Preview button in the Developer Console.Â
What Are Apps For?
- When writing markup, you can add a component to an app, but you can’t add an app to another app, or an app to a component.Â
- An app has a standalone URL that you can access while testing, and which you can publish to your users. We often refer to these standalone apps as “my.app.”Â
- You can’t add apps to Lightning Experience or the Salesforce app—you can only add components. After the last unit this might sound weird; what exactly do you add to the App Launcher, if not an app? What you add to App Launcher is a Salesforce app, which wraps up an Aura component, something defined in a <aura:component>. An Aura components app—that is, something defined in a <aura:application> —can’t be used to create Salesforce apps. A bit weird, but there it is.Â
Component Attributes
Attributes on components are like instance variables in objects. They’re a way to save values that change, and a way to name those value placeholders.
For example, let’s say we wanted to write a helloMessage component that prints a custom message. We can envision adding a message attribute to this component to customize its output.
Example:
<aura:component>Â Â Â Â <aura:attribute name="message" type="String"/>Â Â Â Â <p>Hello! [ message goes here, soon ]</p>Â </aura:component>
Check out another amazing blog here: Overview of Aura Components in Salesforce | The Developer Guide
ExpressionsÂ
An expression is basically a formula, or a calculation, which you place within expression delimiters (“ {!” and “ }”).Â
{!<expression>}Â
An expression is any set of literal values, variables, sub-expressions, or operators that can be resolved to a single value.Â
<aura:component>Â Â Â Â <aura:attribute name="message" type="String"/>Â Â Â Â <p>{!'Hello! ' + v.message}</p>Â </aura:component>
Responses