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
    – Jairam
    Oct 8, 2020 at 10:15

You must log in to answer this question.

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