Component Facets

A facet is any attribute of type Aura.Component[]. Use this type as a placeholder for a block of markup. The body attribute is an example of a facet.

To define your own facet, add an aura:attribute tag of type Aura.Component[], which is an array of components, to your component. For example, let's create a component called facetHeader.cmp.

This component has a header facet. Note how we position the output of the header using the v.header expression.

The component doesn't have any output when you access it directly as the header and body attributes aren't set. Let’s create another component, helloFacets.cmp, that sets these attributes.

The aura:set tag sets the value of the header attribute of facetHeader.cmp.

The body attribute is special. You don’t need to use aura:set if you’re setting the body attribute. Any free markup that’s not enclosed in one of the tags allowed in a component is assumed to be part of the body and is set in the body attribute.

If you use c:helloFacets in an app, the output is: