1

How to use custom labels inside label of LWC Lightning datatable. I'm unable to find any resource or documentation to use custom label instead of HardCoded values inside js controller of LWC cmp. Any suggestion would be helpful. I need to use custom-label in place of hardcoded 'Label'.

const columns = [
    { label: 'Label', fieldName: 'name' }
]

I tried {label.labelreference}/{label-labelreference} -- not working in LWC js

1 Answer 1

2

One way is to import each label:

import labelreference from '@salesforce/label/c.labelreference';

and then you can reference the label in e.g. the columns:

const columns = [
    { label: labelreference, fieldName: 'name' }
];
1
  • Thank you @KeithC for reply. It worked Commented Oct 8, 2020 at 10:15

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.