1

I can put an identifier in the class attribute of an element in a Lightning Web Component; double-quotes are omitted.

<th scope="col" class={flexipageRegionWidth}>

Or I can put a hard-coded class; double-quotes are included.

<th scope="col" class="myStyleClassName">

Is there anyone to include both?

If I try it as below, the identfiier is not interpreted and I get exactly "myStyleClassName {flexipageRegionWidth}" for the class attribute when the component renders.

<th scope="col" class="myStyleClassName {flexipageRegionWidth}">
1
  • 3
    Just make sure the property includes both values.
    – Phil W
    Nov 11, 2022 at 20:50

1 Answer 1

2

Make a getter that combines the values.

get thClass(){
  return `${this.flexipageRegionWidth} myStyleClassName `;
}

Use like this:

<th scope="col" class={thClass}>

You must log in to answer this question.

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