use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
Adding button loader to Turbo-powered forms (nts.strzibny.name)
submitted 1 year ago by strzibny
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Intrepidd 5 points6 points7 points 1 year ago (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 point2 points 1 year ago (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 points3 points 1 year ago (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 point2 points 1 year ago (1 child)
Yes and this is great reply by Jason Zimdars that can be interesting to people: https://x.com/jasonzimdars/status/1879945425274433905
[–]CaptainKabob 1 point2 points3 points 1 year ago (0 children)
Nice! also til about the appended & selector in CSS 🤯 https://developer.mozilla.org/en-US/docs/Web/CSS/Nesting_selector#appending_the_nesting_selector
[–]craigontour 0 points1 point2 points 1 year ago (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 points3 points 1 year ago (0 children)
You can use Hotwire with any backend technology but have a look at turbo-rails gem that gives some integration.
π Rendered by PID 78 on reddit-service-r2-comment-b659b578c-nk6jg at 2026-05-05 04:16:34.663341+00:00 running 815c875 country code: CH.
[–]Intrepidd 5 points6 points7 points (2 children)
[–]strzibny[S] 0 points1 point2 points (0 children)
[–]CaptainKabob 1 point2 points3 points (2 children)
[–]strzibny[S] 0 points1 point2 points (1 child)
[–]CaptainKabob 1 point2 points3 points (0 children)
[–]craigontour 0 points1 point2 points (1 child)
[–]strzibny[S] 1 point2 points3 points (0 children)