function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sales.forcesales.force 

How to use Custom Labels in Lightning Design Attributes?

Rather than creating multiple Lightning components I would like to reuse my components and have the admin specify the Custom Label when they add the component to the page. I am not sure if this is possible although this article screenshots show it working https://salesforce.stackexchange.com/questions/155974/translate-designattribute

When I do the same thing it does not work; it returns the value the admin sets and not the value from the custom label.

Conversely, this article makes me think it is not possible as it says that "Label expressions in markup are supported in .cmp and .app resources only. "https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_config_for_app_builder_design_files.htm

Has anyone got this to work recently?
 
Component

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global" >
 <aura:attribute name="Report" type="String" />
 <p>{!v.Report}</p>

<!--Tried it like this as well-->
<p>{!'$Label.c.'+ v.Report}</p>
</aura:component>


Design
<design:component label="Report">
	<design:attribute name="Report" 
                      label="Report" 
                      Description = "The custom label"
                      default="{!$Label.c.Report}"/>
</design:component>

 
Amit Chaudhary 8Amit Chaudhary 8
Where you are using this Lightning component ? On flexi Pages ?

NOTE:- initially Lighning component took the value from default property then after that its storw it value on flexi pages.