Newer Version Available
Component Markup
Component resources contain markup and
have a .cmp suffix. The markup can contain text or references to other
components, and also declares metadata about the component.
Let's start with a simple "Hello, world!" example in a helloWorld.cmp component.
1swfobject.registerObject("clippy.codeblock-0", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17<aura:component>
18 Hello, world!
19</aura:component>
20This is about as simple as a component can get. The "Hello, world!" text is wrapped in the <aura:component> tags, which appear at the beginning and end of every component definition.
Components can contain most HTML tags so you can use markup, such as <div> and <span>. HTML5 tags are also supported.
1swfobject.registerObject("clippy.codeblock-1", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17<aura:component>
18 <div class="container">
19 <!--Other HTML tags or components here-->
20 </div>
21</aura:component>Use the Developer Console to create components.
aura:component has the following optional attributes.
| 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. |
| implements | String | A comma-separated list of interfaces that the component implements. |