Get started
Installation
Senren installs as a Rails gem. The install generator scaffolds a base ViewComponent class, design tokens, AI-agent files, and a centralized skill map.
Requirements #
Senren targets modern Rails.
- · Ruby
>= 3.1 - · Rails
>= 7.1 - ·
view_component - ·
tailwindcss-rails(or any Tailwind v3 / v4 setup) - ·
importmap-rails+turbo-rails+stimulus-rails
For AI agents #
Using an AI coding agent? Paste this prompt and let it handle everything.
The agent will add the gem, run the install generator, add components, sync agent instruction files, and verify the setup — all in one go.
You are setting up Senren UI in a Rails application.
Senren UI is a Rails-native component library built on ViewComponent,
Hotwire (Turbo + Stimulus), and TailwindCSS.
Steps:
1. Add these gems to the Gemfile:
gem "view_component"
gem "senren-ui", require: "senren/rails"
Then run: bundle install
2. Run the install generator:
bin/rails generate senren:install
3. Add components you need:
bin/rails senren:add button card badge alert dialog form input textarea
4. Sync agent instruction files:
bin/rails senren:agents:sync
5. Verify the installation:
bin/rails senren:doctor
Rules after setup:
- Always read .senren/skill.md before writing UI code.
- Use Senren components before writing custom HTML.
- Use ViewComponent for reusable UI.
- Use Turbo for server state, Stimulus only for local behavior.
- Do not add React, Vue, Alpine, or any external state framework.
- Use semantic Tailwind tokens (--senren-background, --senren-foreground, etc).
- Do not hard-code color families like gray-*, slate-*, zinc-*.
Reference: https://www.senren-ui.dev/llms-full.txt
Manual installation #
Prefer doing it yourself? Follow these five steps.
1. Add the gem
# Gemfile
gem "view_component"
gem "senren-ui", require: "senren/rails"
2. Install
bundle install
bin/rails generate senren:install
The generator creates these files:
3. Add components
Components are added on demand via senren:add.
Each one is copied into app/components/senren/ and is yours to edit.
# Install foundation components
bin/rails senren:add button card badge typography separator skeleton avatar alert
# Install form components
bin/rails senren:add label form input textarea native_select switch
# Install overlays (Stimulus controllers included)
bin/rails senren:add dialog alert_dialog dropdown_menu popover tooltip
4. Wire stylesheets
Add the Senren design tokens stylesheet to your application layout:
<!-- app/views/layouts/application.html.erb -->
<%= stylesheet_link_tag :app, "data-turbo-track": "reload" %>
<%= stylesheet_link_tag "senren", "data-turbo-track": "reload" %>
<%= javascript_importmap_tags %>
5. Verify with doctor
Run the doctor command to confirm every dependency is wired correctly:
bin/rails senren:doctor