What are Aura components in Salesforce?

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

  1. Select File | New | Lightning Component to create an Aura component. 
  2. In the New Lightning Bundle panel, enter helloWorld for the component name.
  3. 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.

dont miss out iconDon'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>

dont miss out iconCheck 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

Popular Salesforce Blogs