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
charbel ALALAMcharbel ALALAM 

how to get a custom label dynamically in lwc,

Hello guys,
i have a question plz, 
how can i get custom label dynamically in lwc,
i have this code in aura and i'm migrating it to lwc:
var currentCat = categoryWrapper.categories[i];
 var labelReference = $A.getReference("$Label.c.";
 component.set("v.tempLabel", labelReference); 
In lwc we can't use $A, or the same function,
we can import the name of custom label and then use the custom label, but it's static. What i want is to get the custom label dynamically,
for example, the value of (name of custom label) the vat of label reference is the value of the custom label (Textile).
we can't use apex because it dosen't work, and i want it in lwc only not in vf, Is there any idea ?
ShivankurShivankur (Salesforce Developers) 
Hi Charbel,

Please check out below thread to understand how you can achieve this requirement:

Hope above information helps. Please mark as Best Answer so that it can help others in future.

mukesh guptamukesh gupta
Hi Charbel,

The point of non-dynamic labels is to provide compile-time safety of labels, and prevent deletion/renaming of labels that would otherwise break code.

As such, there's no real support for dynamic labels in LWC. There's no known timeline when, or if, this might become available.

if you need any assistanse, Please let me know!!

Kindly mark my solution as the best answer if it helps you.