Skip to main content

How do I set the active tab on the tailwindcss-stimulus-components

Gems / Libraries • Asked by Edmundo Ramirez-Semprit

Hi Chris,
I am using the tailwindcss-stimulus-components on a project. The tabs work great, but I can't find how to set the active tab. The problem is that I have different links to forms in each tab and I want to return to the sending tab once the form is processed. Currently it always returns to the first tab . This is something I could do with Foundation. I am sure that there must be a way to di this.

Best regards,


Hey Edmundo,

Oh yeah, great point. I believe you just set data-controller="tabs" data-tabs-index="1" to have it select the 2nd tab, but that would have to be rendered in the HTML.

We may want to add some other method of doing this too. Possibly looking at the anchor in the url and selecting the target with the matching ID.

Perfect, that is just what I needed.


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 24,647+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.