Shadwire

Search the documentation

Search the documentation and component pages by title and by content.

Get started
Introduction
Installation
shadwire.json
Theming
Dark mode
Tools
CLI
Agent skill
Registry
llms.txt
Guides
Composition
Styling
Forms
Icons
Accessibility
Localisation
Blocks
Overview
Components
Overview
Accordion
Alert
Alert Dialog
Aspect Ratio
Avatar
Badge
Breadcrumb
Button
Button Group
Calendar
Card
Carousel
Chart
Checkbox
Collapsible
Combobox
Command
Context Menu
Data Table
Date Picker
Dialog
Drawer
Dropdown Menu
Empty
Field
Hover Card
Icon
Input
Input Group
Input OTP
Item
Kbd
Label
Menubar
Native Select
Navigation Menu
Pagination
Popover
Progress
Radio Group
Resizable
Scroll Area
Select
Separator
Sheet
Sidebar
Skeleton
Slider
Sonner
Spinner
Switch
Table
Tabs
Textarea
Toggle
Toggle Group
Tooltip

shadwire.json

The manifest the CLI writes at your app's root. diff, update and remove read it to know what you have installed.

shadwire init writes this file once. After that, every add, update and remove updates the installed section. Commit it along with the rest of your code.

{
  "$schema": "https://shadwire.edumoraes.dev.br/schema.json",
  "registry": "https://shadwire.edumoraes.dev.br/r",
  "tailwind": { "css": "app/assets/tailwind/application.css" },
  "aliases": {
    "components":  "app/components",
    "ui":          "app/components/ui",
    "helpers":     "app/helpers",

Fields

Field What it is
registry The base URL the CLI installs from. init --registry sets it. Accepts https:// and file://.
tailwind.css The app's Tailwind entrypoint, where init adds the @import of shadwire.css.
aliases Where each kind of file goes. Change these if your app does not follow the standard Rails tree.
installed One entry per component: the registry version and the files it owns. diff, update and remove work from this list.

Aliases

Each file in the registry has a kind (component, helper, Stimulus controller, CSS), and the alias for that kind sets the directory it is written to.

Alias Default Receives
components app/components The shared UiComponent superclass.
ui app/components/ui The component classes and their templates.
helpers app/helpers The Ui::*Helper modules holding the ui_* wrappers.
controllers app/javascript/controllers The Stimulus controllers of the interactive components.
vendorCss vendor/shadwire shadwire.css, which holds the tokens.

If your app has a different layout, an engine for example, point the aliases at the right directories before the first add:

{
  "aliases": {
    "components":  "app/components",
    "ui":          "app/components/ui",
    "helpers":     "app/helpers",
    "controllers": "app/javascript/controllers",
    "vendorCss":   "app/assets/stylesheets/shadwire"
  },

The Tailwind @import

init adds this import to the file tailwind.css points to. It is what brings the tokens into the Tailwind build:

@import "tailwindcss";
@import "../../../vendor/shadwire/shadwire.css";

bin/shadwire status --json includes tailwind.importPresent. If it is false, the import has been removed and the components will render without colours.

How the registry is resolved

Every command picks the registry URL in this order:

  1. the --registry flag, if passed;
  2. the registry field of the app's shadwire.json;
  3. the built-in default, https://shadwire.edumoraes.dev.br/r.
bin/shadwire add button --registry file://$PWD/build/r
shadwire init --registry https://ui.example.com/r

Passed to init, --registry is saved in the file. Passed to any other command, it only applies to that run. The Registry page describes the format.