diff --git a/bootstrap_barrio.theme b/bootstrap_barrio.theme
index 5443ad98274b412913b102e256fbac39203f5e5a..ddb1478d7065c9adf4d773fcd5926903b3509a7d 100644
--- a/bootstrap_barrio.theme
+++ b/bootstrap_barrio.theme
@@ -473,12 +473,18 @@ function bootstrap_barrio_preprocess_menu_local_task(&$variables) {
   $options = $url->getOptions();
   $url->setOptions($options + $link['localized_options']);
   $variables['item'] = Link::fromTextAndUrl($link['title'], $url);
+}
+
+/**
+ * Implements hook_preprocess_HOOK() for menu-local-tasks.html.twig.
+ */
+function bootstrap_barrio_preprocess_menu_local_tasks(&$variables) {
   switch (theme_get_setting('bootstrap_barrio_tabs_style')) {
     case 'pills':
-      $variables['nav-style'] = 'nav-pills';
+      $variables['nav_style'] = 'nav-pills';
       break;
     default:
-      $variables['nav-style'] = 'nav-tabs';
+      $variables['nav_style'] = 'nav-tabs';
       break;
   }
 }
diff --git a/templates/navigation/menu-local-tasks.html.twig b/templates/navigation/menu-local-tasks.html.twig
index 74a2e9618f366026bf8af4d3d70186dfc76e51c4..bcaf766e28e2290a4e315e9c285371f34784690a 100644
--- a/templates/navigation/menu-local-tasks.html.twig
+++ b/templates/navigation/menu-local-tasks.html.twig
@@ -14,11 +14,20 @@
  */
 #}
 {{ attach_library('bootstrap_barrio/tabs') }}
+{%
+  set classes = [
+    'nav',
+    primary ? 'primary',
+    secondary ? 'secondary',
+    nav_style ? nav_style : 'nav-tabs',
+  ]
+%}
+
 {% if primary %}
   <h2 class="visually-hidden">{{ 'Primary tabs'|t }}</h2>
-  <ul class="nav {{ nav-style }} primary">{{ primary }}</ul>
+  <ul{{ attributes.addClass(classes) }}>{{ primary }}</ul>
 {% endif %}
 {% if secondary %}
   <h2 class="visually-hidden">{{ 'Secondary tabs'|t }}</h2>
-  <ul class="nav {{ nav-style }} secondary">{{ secondary }}</ul>
+  <ul{{ attributes.addClass(classes) }}>{{ secondary }}</ul>
 {% endif %}