We've moved discussions to Discord

Turbo Stream opening a Tailwind Modal

Ryan Fox
Hi, has anyone had any luck opening a Tailwind modal with turbo stream?

The included tailwindcss-stimulus-components modal controller seems to require a click to open a modal properly. I'm using turbo stream to render the modal so I can't use the originating link to also activate the click->open method.

Trying for something like they show here: They use bootstrap and call this.modal.show() from their modal_controller.

Hotwire Modals | Drifting Ruby


Ryan Fox
I copied over the modal_controller.js and then hid the button and clicked it in the connect() method...
tailwindcss-stimulus-components/modal.js at master · excid3/tailwindcss-stimulus-components (github.com)

Probably a more elegant solution but it works..
Notifications
You’re not receiving notifications from this thread.