Getting started
Add Wabi to a Rails 8 app (created with --css tailwind) in a few steps.
1. Install the gem
bundle add wabi2. Set up Phlex
bin/rails g phlex:installCreates the Components:: and Views:: namespaces Wabi components autoload under. Skip if your app already uses phlex-rails.
3. Run the installer
bin/rails g wabi:installCopies the default tokens.css, the theme controller, and initializes config/wabi.lock.json.
4. Wire Tailwind 4
In app/assets/tailwind/application.css, import the tokens AFTER tailwindcss:
@import "tailwindcss";
@import "./wabi/tokens.css";
Use stylesheet_link_tag "tailwind" (not "application") so the compiled output is what loads.
5. Mount the theme controller
On your <html> tag so Wabi can read/write data-theme and data-mode for theme + dark-mode switching:
html(data: { controller: "wabi--theme" }) do
# ...
end
6. Add components
bin/rails g wabi:add button dialog cardInteractive components print the Zag.js pin lines to paste into config/importmap.rb — follow the generator output, then restart the server.
Components autoload under Components::UI::* (Phlex 2.x convention). Render them anywhere:
render Components::UI::Button.new(appearance: :primary) { "Click me" }