excid3 / tailwindcss-stimulus-components

A set of StimulusJS components for TailwindCSS apps similar to Bootstrap JS components.
https://excid3.github.io/tailwindcss-stimulus-components/
MIT License
1.36k stars 137 forks source link

Toggle feature cannot have multiple divs to have different status #216

Closed zben closed 8 months ago

zben commented 8 months ago

I have 2 divs that I wanna toggle. Div A starts as hidden and Div B starts as not hidden. When I click button, I want A to show and B to hide. The current toggle feature assumes a global data-toggle-open-value. Is it possible to set data-toggle-open-value per child div? or just look at if the div has hidden class or not and toggle them individually? I think that will be more flexible.

This will be really helpful if I want to have swapping effect and switch between 2 sets of content.