How to add an additional class to each element in the menu-local-task.html.twig template? I need to change the admin tab template by adding my wrapper and class to it.
This is the default code:
&lt;li{{ attributes.addClass(is_active ? 'is-active') }}&gt;{{ link }}&lt;/li&gt;

My code:
&lt;div {{ .attributes.addClass(is_active ? 'DefTabs__tabItem--active') }}&gt;{{ link }}&lt;/div&gt;

Currently, the &quot;DefTabs__tabItem--active&quot; class is added to the active link, but I need to add an additional CSS class &quot;DefTabs__tabItem&quot; to each DIV element. How can I do this?
Create an array, ex:
{%
    set classes = [   
      is_active ? 'is-active',
      'my-second-class-name',
    ]
%}

&lt;div {{ attributes.addClass(classes) }}&gt;{{ link }}&lt;/div&gt;



Currently, the &quot;DefTabs__tabItem--active&quot; class is added to the active
link, but I need to add an additional CSS class &quot;DefTabs__tabItem&quot; to
each DIV element.

By the way, no need to repeat yourself with the naming, do this:
{%
    set classes = [   
      'DefTabs__tabItem',
      is_active ? 'active',
    ]
%}

&lt;div {{ attributes.addClass(classes) }}&gt;{{ link }}&lt;/div&gt;

Then in CSS you can target the active with .DefTabs__tabItem.active { ... }