What are Custom Labels and how are they used in Apex and LWC?
Suggested answer
Custom Labels are reusable text values defined in Setup that can be used across Apex, Visualforce, and LWC. They support translation — you can define different values per language, enabling multi-language applications. In Apex: System.Label.MyLabel. In Visualforce: {!$Label.MyLabel}. In LWC: Import with import LABEL_NAME from '@salesforce/label/c.MyLabel'; and reference as a property. Use custom labels for: UI text strings, error messages, success messages, and any text that may need to be translated or updated without a code deployment. Labels can also be used in Flows, formula fields, and validation rules. Maximum 5,000 custom labels per org.
Practice content for interview preparation; not an official vendor answer. Verify details against current product documentation.
Community comments (0)
No comments yet.
Sign in or create a free account to add a comment. Comments are moderated before they appear.