Ask A Question

Notifications

You’re not receiving notifications from this thread.

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

Edmundo Ramirez-Semprit asked in Gems / Libraries

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,

Edmundo

Reply

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.

Reply

Perfect, that is just what I needed.

Thanks

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,464+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.