11

I want all my components attribute to be available for configuration in Ligthtning builder, so an admin like person can override default values. How can I do that?

<aura:component controller="namespace.SObjectSearch" implements="flexipage:availableForAllPageTypes">
    <aura:attribute name="sobject" type="String" default="account"/>
    <aura:attribute name="query" type="String" default="Select Id, Name From Account"/>
    <aura:attribute name="fields" type="String[]" default="['Id', 'Name']"/>
    <form>
        <ui:inputText class="form-control" label="Search" aura:id="searchField" value="" placeholder="enter search string"/>
        <ui:button label="Submit" press="{!c.searchSObjects}"/>
    </form>
    <ul class="list-group">
        <aura:iteration var="sobj" items="{!v.sobjects}">
            <li class="list-group-item"><a aura:id="sobjid" target="_blank" href="{!'/' + sobj.Id}">{!sobj.Name}</a></li>   
            <!--<aura:iteration var="prop" items="{!v.properties}">
            </aura:iteration> -->
        </aura:iteration>
    </ul>
</aura:component>

1 Answer 1

17

You can do this by creating a design file for your component .

enter image description here

Now create a design file for your attributes

<design:component label="SobjectSearch">
<design:attribute name="sobject" label="sobject" description="Enter Sobject Name hereprincipal" />
<design:attribute name="query" label="query" description="Type query here" />
<design:attribute name="fields" label="fields" description="Enter comma separated fields" />

Only Boolean, Integer or String attributes can be exposed in design files.

Array of string will render as multi pick-list value .

The link from documentation

https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_config_for_app_builder.htm

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .