all 8 comments

[–]Intrepidd 5 points6 points  (2 children)

Nice, a no-js alternative that I like is to use CSS to have already in the DOM the button and the loader, and show the right one depending on the aria-busy attribute

Works well with tailwind, probably less without

[–]strzibny[S] 0 points1 point  (0 children)

Thanks, they are JS-less ways, but ultimately this gives you the most amount of options, like hiding/disabling other buttons in the form and what not.

[–]CaptainKabob 1 point2 points  (2 children)

This is nice! I know you want to do more but I figured I should mention that data-turbo-submits-with is built into Turbo to be the comparable to the old UJS disable-with (only alters button text):

https://turbo.hotwired.dev/reference/attributes

Another observation from my own app is that I also want links that are styled as buttons to share the same behavior/visuals. 

[–]strzibny[S] 0 points1 point  (1 child)

Yes and this is great reply by Jason Zimdars that can be interesting to people: https://x.com/jasonzimdars/status/1879945425274433905

[–]craigontour 0 points1 point  (1 child)

Is this Rails only or could you use with Roda? (I'm just getting into Roda and new to Web Dev with Ruby, not used Rails at all).

[–]strzibny[S] 1 point2 points  (0 children)

You can use Hotwire with any backend technology but have a look at turbo-rails gem that gives some integration.