Newer Version Available

This content describes an older version of this product. View Latest

Lightning Component Bundle Design Resources

Use a design resource to control which attributes are exposed to the Lightning App Builder. A design resource lives in the same folder as your .cmp resource, and describes the design-time behavior of the Lightning component—information that visual tools need to allow adding the component to a page or app.

To make a Lightning component attribute available for administrators to edit in the Lightning App Builder, add a design:attribute node for the attribute into the design resource. An attribute marked as required in the component definition automatically appears for users in the Lightning App Builder, unless it has a default value assigned to it. Required attributes with default values and attributes not marked as required in the component definition must be specified in the design resource or they won’t appear for users.

A design resource supports only attributes of type int, string, or boolean.

What Can You Do with Design Resources?

Render a field as a picklist
To render a field as a picklist, add a datasource onto the attribute in the design resource, like this:
Any string attribute with a datasource in a design resource is treated as a picklist.
Set a default value on an attribute
You can set a default value on an attribute in a design resource, like this:
Restrict a component to one or more objects
Use the <sfdc:object> tag set to specify which objects your component is valid for.
For example, here’s a design resource that goes in a bundle with a “Hello World” component.
Here’s the same design resource restricted to two objects.
If an object is installed from a package, add the namespace__ string to the beginning of the object name when including it in the <sfdc:object> tag set. For example: objectNamespace__ObjectApiName__c.