How to access multiple line custom label and static resource file uses of “@salesforce/label/” and “@salesforce/resourceUrl/” property in Lightning Web Component Salesforce Lwc | How to display custom label of image, text and URLs format in Lwc (Lightning Web Component) Salesforce

Vijayk
4 min readFeb 22, 2022

--

Hey guys, today in this post we are going to learn about How to access multiple line custom label and static resource file uses of “@salesforce/label/” and “@salesforce/resourceUrl/” property in Lightning Web Component Salesforce Lwc.

Import labels from the @salesforce/label scoped module. Custom labels are text values stored in Salesforce that can be translated into any language that Salesforce supports. Use custom labels to create multilingual applications that present information (for example, help text or error messages) in a user’s native language. To know more details about Custom labels, Click Here..

  • labelName- A name that refers to the label.
  • labelReference- The name of the label in your org in the format namespace.labelName. You can use the same format to access labels, myns.labelName, regardless of where you’re accessing them.

Files we used to display Custom labels in Salesforce LWC →

lwcCustomLabel.html

LWc HTML File

Template HTML file for used to display multi custom label in Salesforce LWC

lwcCustomLabel.js

LWC JavaScript File

It is holding import and export method where we are importing the multiple custom label Reference property in Salesforce LWC.

lwcCustomLabel.js-meta.xml

XML Meta File

It is used to where this lightning web component file you want to display as like lightning__AppPage, lightning__RecordPage, lightning__HomePage.

lwcMultipleOptionsApp.app

Lightning Application

It is used for call the component and preview on browser.

Final Output → To get source code live demo, Click here..

Other related post that would you like to learn in LWC

Create Lightning Web Component HTML →

Step 1:- Create Lightning Web Component : lwcCustomLabel.html

SFDX:Lightning Web Component >> New >> lwcCustomLabel.html

lwcCustomLabel.html [Lightning Web Component HTML]

Create Lightning Web Component JavaScript →

Step 2:- Create Lightning Web Component : lwcCustomLabel.js

SFDX:Lightning Web Component >> New >> lwcCustomLabel.js

lwcCustomLabel.js [LWC JavaScript File]

Create Lightning Web Component Meta XML →

Step 3:- Create Lightning Web Component : lwcCustomLabel.js-meta.xml

SFDX:Lightning Web Component >> New >> lwcCustomLabel.js-meta.xml

lwcCustomLabel.js-meta.xml [LWC Meta Data XML]

Lightning Web Component Meta XML

Create Lightning Application →

Step 4:- Create Lightning Application : lwcCustomLabelApp.app

From Developer Console >> File >> New >> Lightning Application

lwcCustomLabelApp.app [Component Application File]

Further post that would you like to learn in LWC FAQ (Frequently Asked Questions)

How do you read custom labels in LWC?

import labelName from ‘@salesforce/label/LabelReference’; labelName — This is the name that we use to access labels in LWC. LabelReference — This is the name of the custom label. For example, If we have a namespace, then LabelReference -> Namespace.

How do I access custom labels?

To access custom labels, from Setup, enter Custom Labels in the Quick Find box, then select Custom Labels. How you add a custom label to your application depends on the user interface. For more information on the following syntax, see the corresponding developer guides. In Apex use the System.

What are custom labels?

Custom labels are simply another attribute within the product feed. These can be used in your shopping campaign, which allows you to identify, group, filter and structure products in order to apply your product listing ad strategies. For example, you may want use a different bid strategy for some items.

Final Output → To get source code live demo, Click here..

Hi, This is Vijay behind the admin and founder of w3web.net. I am a senior software developer and working in MNC company from more than 8 years. I am great fan of technology, configuration, customization & development. Apart of this, I love to write about Blogging in spare time, Working on Mobile & Web application development, Salesforce lightning, Salesforce LWC and Salesforce Integration development in full time. [Read full bio] | | The Sitemap where you can find all published post on w3web.net

Originally published at https://www.w3web.net on February 22, 2022.

--

--

Vijayk
Vijayk

Written by Vijayk

Easy to learn step-by-step online tutorial by www.w3web.net

No responses yet