How to use Custom Labels In Lightning Web Component(LWC)

by Rijwan Mohmmed
0 comment
How to use Custom Labels In Lightning Web Component(LWC)

Custom labels are simple text values that can be accessed from LWC Component, Aura Component, Apex classes, Visualforce pages.

Create Custom Labels :

Go To Setup —>Create — >Custom Labels.
Click on New Custom Labels.Enter value for name, value, and description.

Use Custom Label in LWC Component :

We can get custom label value by import a label in a Lightning Web Component JavaScript file, use @salesforce/label .

import labelName from '@salesforce/label/labelReference';
  1. labelName — A name that refers to the label in LWC JS File.
  2. labelReference — The name of the label in your org in the format namespace.labelName. if no namespace then you can use labelName.


import { LightningElement } from 'lwc';
//Import custom labels
import techdicertes1 from '@salesforce/label/c.techdicertes1';
import greeting  from '@salesforce/label/c.greeting ';

export default class LabelExample extends LightningElement {
    // Expose the labels to use in the template.
    label = {

techdicerLabel.html :


Reference :

You may also like

Leave a Comment