how to add custom label in list in lightning component code example

Example 1: get custom label in lightning component

$A.get("$Label.namespace.labelName")

Example 2: how to add custom label in list in lightning component

<aura:attribute type="String[]" name="values" default="[]" access="private" />

({
  doInit: function(component, event, helper) {
    const values = [
      $A.get("$Label.c.MyLabel"),
      $A.get("$Label.c.MyLabel2"),
      $A.get("$Label.c.MyLabel3"),
      $A.get("$Label.c.MyLabel4"),
        /* ... */
    ];

    component.set('v.values', values);
 }
})

Tags:

Misc Example