Blocks

Installation

Get shadcnrb running in your Rails 8 app.

1. Add the gem

# Gemfile
gem "shadcnrb", github: "fnbyte/shadcn-rb"
bundle install

2. Run the installer

bin/rails g shadcnrb:install

This writes:

  • def sui helper in ApplicationHelper
  • app/components/shadcnrb/builder.rb — your local Builder subclass
  • shadcn oklch @theme tokens in app/assets/tailwind/application.css
  • Stimulus controllers in app/javascript/controllers/shadcnrb/

3. Install components

bin/rails g shadcnrb:component button
bin/rails g shadcnrb:component dialog
bin/rails g shadcnrb:component sidebar

Each component copies a single Ruby module to app/components/shadcnrb/components/<name>.rb, pulls in any Stimulus dependencies, and appends an include line to your Shadcnrb::Builder.

4. Use them

<%= sui.button "Save", variant: :default %>

That's it. See the sidebar for per-component docs and live examples.

Requirements

  • Ruby ≥ 3.2
  • Rails ≥ 7.1 (Rails 8 recommended)
  • Tailwind CSS v4
  • importmap-rails (default for Rails 8)