There was a feature for an Aura framework which supported Dynamically Populating Label Parameters in Aura component syntax providing functionality to format static label so that it is possible to specify "hello {0}" in the label text and display in UI "hello username" where username is current user name or any other populated value.

It is also confirmed here and here that this was supported for the Aura framework. I expect this to be natively supported by LWC as well.

However, looks like there is no corresponding feature in Lightning Web Component syntax or I can't find any information about it.

Can anyone help?

  • 1
    Technical duplicate of this question, but cannot be closed as such because of lack of upvotes. As far as I can tell, we still don't have any such utility.
    – sfdcfox
    Oct 28, 2019 at 13:50
  • @sfdcfox, it is not, I am not trying to get here dynamic label, but rather use label as string format and supply parameters to a label like I could in Aura component
    – Patlatus
    Oct 28, 2019 at 13:53
  • 1
    Makes more sense now. I was apparently not the only person who thought this, you might want to edit your question to clarify.
    – sfdcfox
    Oct 28, 2019 at 14:00
  • @sfdcfox ok, I have updated my answer. Maybe I have overestimated the familiarity with Aura framework features
    – Patlatus
    Oct 28, 2019 at 14:12

2 Answers 2


I think I will use the following workaround.

I would create a service LWC called formatUtils.

const format = (format) => { 
var args = Array.prototype.slice.call(arguments, 1);
return format.replace(/{(\d+)}/g, function(match, number) { 
  return typeof args[number] != 'undefined'
    ? args[number] 
    : match

and then use it

format( label, ['param1', 'param2'])

Dynamic importing for modifying custom labels isn't available yet.

Another source.

  • 1
    I am not trying to import labels dynamically, i am trying to format static label so that I could have "hello {0}" in my label and display in LWC "hello Atlas" where Atlas is current user name or any other populated value. Dynamic import will not solve this problem
    – Patlatus
    Oct 28, 2019 at 13:57
  • 1
    I understand, maybe you can getter and setters on your property to use/modify the label string?
    – Atlas Can
    Oct 28, 2019 at 13:57
  • 1
    I guess I would try to use some workaround like service component
    – Patlatus
    Oct 28, 2019 at 14:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .