Newer Version Available

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

Using Custom Labels

Use custom labels in Lightning components with the $Label global value provider.

Custom labels are custom text values that can be translated into any language Salesforce supports. Custom labels enable developers to create multilingual applications by automatically presenting information (for example, help text or error messages) in a user's native language.

To create custom labels, from Setup, enter Custom Labels in the Quick Find box, then select Custom Labels.

Use this syntax to access custom labels in Lightning components:

  • $Label.c.labelName for the default namespace
  • $Label.namespace.labelName if your org has a namespace

Here are some examples.

Label in a markup expression using the default namespace
{!$Label.c.labelName}
Label in JavaScript code if your org has a namespace
$A.get("$Label.namespace.labelName")

Custom labels referenced in a Lightning component are not automatically added when you create a package containing the Lightning component. To include a custom label in a package, another member of the package, such as a Visualforce page, must reference the custom label.

Note