Components are the functional units of Aura, which encapsulate modular and reusable sections of UI. They can contain other components or HTML markup. The public parts of a component are its attributes and events. Aura provides out-of-the-box components in the aura and ui namespaces.
Every component is part of a namespace. For example, the button component is saved as button.cmp in the ui namespace can be referenced in another component with the syntax <ui:button label="Submit"/>, where label="Submit" is an attribute setting.
<aura:component> <!-- Optional coponent attributes here --> <!-- Optional HTML markup --> <div class="container"> Hello world! <!-- Other components --> </div> </aura:component>
Attribute | Type | Description |
---|---|---|
access | String | Indicates whether the component can be used outside of its own namespace. Possible values are public (default), and global. |
controller | String | The server-side controller class for the component. The format is namespace.myController. |
description | String | A description of the component. |
extends | Component | The component to be extended. |
extensible | Boolean | Set to true if the component can be extended. The default is false. |
implements | String | A comma-separated list of interfaces that the component implements. |
isTemplate | Boolean | Set to true if the component
is a template. The default is false. A template must have isTemplate="true" set in its
<aura:component>
tag.<aura:component isTemplate="true" extends="aura:template"> |
template | Component | The template for this component. A template bootstraps loading of
the framework and app. The default template is aura:template. You can customize
the template by creating your own component that extends the default
template. For example: <aura:component extends="aura:template" ... > |
aura:component includes a body attribute defined in a <aura:attribute> tag. Attributes usually control the output or behavior of a component, but not the configuration information in system attributes.
Attribute | Type | Description |
---|---|---|
body | Component[] | The body of the component. In markup, this is everything in the body of the tag. |