title: Add CSS class to selected Wicket Tab
body: <p>I have couple Wicket Tabs and I need to add CSS class <em><strong>&quot;text-primary&quot;</strong></em> to the current selected tab</p>
  <pre class="lang-java prettyprint-override"><code>        List&lt;ITab&gt; tabList = new ArrayList&lt;&gt;();
          tabList.add(new AbstractTab(new Model&lt;&gt;(&quot;Tab 1&quot;)) {
              @Override
              public Panel getPanel(String panelId) {
                  return new TabPanel1(panelId);
              }
          });
          tabList.add(new AbstractTab(new Model&lt;&gt;(&quot;Tab 2&quot;)) {
              @Override
              public Panel getPanel(String panelId) {
                  return new TabPanel2(panelId);
              }
          });
          add(new AjaxTabbedPanel&lt;&gt;(&quot;tabs&quot;, tabList) {
              @Override
              protected WebMarkupContainer newLink(String linkId, int index) {
                  AjaxFallbackLink&lt;Void&gt; link = new AjaxFallbackLink&lt;&gt;(linkId) {
                      private static final long serialVersionUID = 1L;
  
                      @Override
                      public void onClick(Optional&lt;AjaxRequestTarget&gt; target) {
                          TabbedPanel&lt;ITab&gt; selectedTab = setSelectedTab(index);
                          ITab tab = tabList.get(index);
                          if (target.isPresent()) {
  
                              tab.getPanel(linkId);
  
                              target.get().add(selectedTab);
                          }
                          onAjaxUpdate(target);
                      }
                  };
                  link.add(AttributeAppender.append(&quot;class&quot;, &quot;text-primary&quot;));
                  return link;
              }
          });
  </code></pre>
  <p>This is how looks like markup for the Link</p>
  <pre class="lang-html prettyprint-override"><code>&lt;a href=&quot;#&quot; wicket:id=&quot;link&quot;&gt;&lt;span wicket:id=&quot;title&quot;&gt;[[tab title]]&lt;/span&gt;&lt;/a&gt;
  </code></pre>
  <p>this implementation adds to the both tabs css class and I need to check somehow if tab is selected</p>