garn
Installation
Add garn to an existing React and Tailwind v4 project, or start with a new Next.js or Vite app. The CLI sets up the shared theme and copies the components you choose into your project as source.
Install
Already have a React + Tailwind project?
Run this from the project root. It initializes garn and adds your first components in one step:
Use --yes for a non-interactive setup, such as CI. Prefer to initialize first and add components later? Use the step-by-step path below.
Requirements
init checks the React, Tailwind, and alias requirements and, in a terminal, offers to fix a missing one. In CI or a pipe (or with --yes) it applies or prints the fix without ever blocking. Missing the alias? Add it to your tsconfig.json (use ./src/* with a src/ layout):
{
"compilerOptions": {
"paths": { "@/*": ["./*"] }
}
}On Tailwind v3? garn needs the v4 engine — see the upgrade guide.
Set up your AI agent
garn works without an AI client. If you use one, hand it the setup — or wire the two pieces yourself below.
Paste the setup into your agent
1 · Project rules
init writes garn's token, accessibility, and usage rules to .garn/rules.md. Import it from your agent's memory file so it's in every session:
@.garn/rules.mdUsing AGENTS.md? Add: “Before writing any UI, read .garn/rules.md and follow it.”
2 · The MCP server
Lets your agent search components, read the reference, pull examples and recipes, and audit its own compositions. init offers to register it — or run it anytime, for Claude Code, Cursor, or VS Code:
By hand: claude mcp add garn -- npx -y garn-mcp — other clients take npx -y garn-mcp in their MCP config.
No MCP client? The same knowledge is served flat at /llms-full.txt. What the machine-readable layer contains — and the full agent workflow — is on the For agents page.
What's next
Browse components
The full roster — every page has live examples, props, accessibility and keyboard behaviour, and its exact add command.
Own the source
Everything the CLI writes is yours to edit — no runtime dependency to outgrow. Re-running add updates a component to the latest registry version (asking before it replaces your edits), and npx garn-ui status shows which copied-in components you've edited locally.
Already using the shadcn CLI?
garn serves standard registry-item JSON, so the shadcn CLI can install garn components too. Register the namespace in your components.json:
{
"registries": {
"@garn": "https://garn.ohuba.com/r/{name}.json"
}
}npx shadcn@latest add @garn/buttonThe garn CLI adds a few extras on top (theme auto-wiring, requirement checks, the .garn/ AI layer), but the components land the same either way.