Newer Version Available

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

Configure Components for Communities

Make your custom Lightning components available for drag and drop in the Community Builder.

Add a New Interface to Your Component

To appear in the Community Builder, a component must implement the forceCommunity:availableForAllPageTypes interface.

Here’s the sample code for a simple “Hello World” component.
1<aura:component implements="forceCommunity:availableForAllPageTypes" access="global">
2    <aura:attribute name="greeting" type="String" default="Hello" access="global" />
3    <aura:attribute name="subject" type="String" default="World" access="global" />
4
5    <div style="box">
6      <span class="greeting">{!v.greeting}</span>, {!v.subject}!
7    </div>
8</aura:component>

Mark your resources with access="global" to make the resource usable outside of your own org; for example, if you want the resource to be usable in an installed package or by a Lightning App Builder user or a Community Builder user in another org.

Note

Next, add a design resource to your component bundle. A design resource describes the design-time behavior of a Lightning component—information that visual tools need to allow adding the component to a page or app. It contains attributes that are available for administrators to edit in the Community Builder.

Adding this resource is similar to adding it for the Lightning App Builder. For more information, see Configure Components for Lightning Pages and the Lightning App Builder.