Introduction
shadcn/ui components for Rails, exposed as an ActionView builder. You own the code. Real Rails helpers underneath.
What is this?
shadcnrb is a Ruby port of
shadcn/ui,
built for Rails (7.1+) with Tailwind v4. Components are plain Ruby modules mixed into a
Shadcnrb::Builder object,
accessible in every view as sui.
Under the hood, every actionable component wraps the corresponding Rails helper —
so sui.button_to is a real
button_to with CSRF + Turbo,
sui.link_to is a real
link_to, and so on.
Philosophy
- You own the code. The installer copies components into your app — edit them however you like.
- Rails-native. Every component mirrors the Rails helper it wraps. No custom
href:kwarg; use real route helpers. - One dir per component. Markup, Tailwind classes, and Stimulus controller all live together in
app/components/shadcnrb/<name>/. - Portal pattern for overlays. Toasts, dialogs, drawers inject into
document.body— no wrapping controllers.
Quick example
<%= sui.button "Save", variant: :default %>
<%= sui.button_to "Delete", "#", method: :delete, variant: :destructive %>