Installation

Copy prompt for your AI agent

Paste it into Claude Code, Cursor or GitHub Copilot. The agent detects your stack, picks the npm package, the shadcn registry or CSS only, installs it, adds the imports, renders one sample button and runs your build.

Install Cozy UI (prompt)
Install Cozy UI in this project. Cozy UI is an MIT React UI kit with shadcn/ui component APIs, built on Radix UI. Docs: https://cozy-ui.solo.engineer/ (plain text: https://cozy-ui.solo.engineer/llms.txt). Do the steps in order. Use the project's package manager (from the lock file: pnpm, yarn, bun or npm) for every install. Do not change unrelated code.

1. Detect the stack. Read package.json, the lock file and the config files, then tell me:
   - React version ("react" in package.json), or "no React".
   - Framework or bundler: Next.js (App Router or Pages Router), Vite, Remix / React Router, Astro, or other.
   - Tailwind CSS v4: yes if "tailwindcss" is version 4 or later, or a CSS file has @import "tailwindcss".
   - shadcn/ui: yes if components.json exists at the project root.

2. Pick exactly one path and tell me which and why:
   - A. shadcn registry: components.json exists AND Tailwind CSS v4 is used. The source is copied into the repo.
   - B. npm package: React 18 or 19, every other React case (no Tailwind, Tailwind v3, or no components.json).
   - C. CSS only: no React (Vue, Svelte, plain HTML, server templates).
   If React is older than 18, stop and tell me.

3. Install.
   - A. In components.json, add this key next to the existing ones:
       "registries": { "@cozy": "https://cozy-ui.solo.engineer/r/{name}.json" }
     Then run: npx shadcn@latest add @cozy/cozy-theme @cozy/button
     Then install @fontsource/nunito.
   - B. Install @0xtrou/cozy-ui.
   - C. Nothing to install.

4. Add the styles once, at the app root.
   - A. In the global CSS file that imports Tailwind (for example app/globals.css or src/index.css), after the shadcn theme variables:
       @import "@fontsource/nunito/400.css";
       @import "@fontsource/nunito/200.css";
       @import "<relative path to the cozy.css the CLI wrote, usually styles/cozy.css>";
   - B. In the root entry file (Next.js App Router: app/layout.tsx; Pages Router: pages/_app.tsx; Vite: src/main.tsx; Remix / React Router: app/root.tsx):
       import "@0xtrou/cozy-ui/fonts.css";
       import "@0xtrou/cozy-ui/styles.css";
     If Tailwind CSS v4 is used, import "@0xtrou/cozy-ui/cozy.css" instead of "@0xtrou/cozy-ui/styles.css", so utilities are not shipped twice.
   - C. In the <head> of the main HTML template:
       <link rel="stylesheet" href="https://unpkg.com/@0xtrou/cozy-ui/dist/fonts.css" />
       <link rel="stylesheet" href="https://unpkg.com/@0xtrou/cozy-ui/dist/cozy.css" />
   In every path, give the page the kit's background and type in the global CSS:
       body { background: var(--cz-page); color: var(--cz-text); font-family: var(--cz-font-family); }

5. Palette (only if I asked for one). Set data-palette on the <html> element: village, meadow, lotus, river or lantern (dark). With no attribute the page follows the system: Village in light mode, Lantern in dark mode. For Liquid Glass, also set data-material="glass".

6. Verify with one sample. Add one button to an existing page:
   - A. import { Button } from "@/components/ui/button" (use the "ui" alias from components.json), then <Button variant="reward">Harvest</Button>
   - B. import { Button } from "@0xtrou/cozy-ui", then <Button variant="reward">Harvest</Button>
   - C. <button class="cz-button cz-button--reward">Harvest</button>
   If the app uses toast: mount <Toaster /> once at the root (B: import { Toaster, toast } from "@0xtrou/cozy-ui"; A: run npx shadcn@latest add @cozy/sonner, then import { Toaster } from "@/components/ui/sonner" and toast from "sonner").
   If the app uses Tooltip: wrap the root in <TooltipProvider> (B: from "@0xtrou/cozy-ui"; A: from "@/components/ui/tooltip").

7. Run the project's build and type check: the "build" and "typecheck" scripts in package.json if they exist, otherwise npx tsc --noEmit. Fix any error you caused.

8. Report the path you chose, every file you changed and the command results. Then suggest the Cozy UI MCP server, so you can look up components and props from the real docs:
   Claude Code: claude mcp add cozy-ui -- npx -y @0xtrou/cozy-ui-mcp
   Cursor, VS Code, Claude Desktop (mcpServers config): "cozy-ui": { "command": "npx", "args": ["-y", "@0xtrou/cozy-ui-mcp"] }

Pick the path that matches your team. Each one gets you to a pressable cozy button in a few minutes.

You areUseWhy this path
Anyone with an AI coding agentAgent promptPaste one prompt; the agent picks the path below and installs it.
React team that wants it working todaynpm packageOne install, prebuilt styles, no Tailwind needed.
Project already on shadcn/uishadcn registryCode is copied into your repo, so you can change anything.
Any other stack (Vue, Svelte, plain HTML)CSS onlyThe look is plain CSS classes; no React needed.
Team using an AI coding assistantMCP serverThe assistant reads the real docs instead of guessing props.
Game team on UnityUnity guideSame tokens and class names in USS.
DesignerTokensOne JSON file holds every colour, depth and timing.

React app: npm package

Fastest to ship. React 18 or 19, in Vite, Next.js or Remix. Tailwind is optional. Import the styles once, in your root entry file: src/main.tsx (Vite), app/layout.tsx (Next.js App Router), pages/_app.tsx (Pages Router) or app/root.tsx (Remix, React Router).

npm install @0xtrou/cozy-ui
app.tsx
import "@0xtrou/cozy-ui/fonts.css";
import "@0xtrou/cozy-ui/styles.css";
import { Button, Toaster, TooltipProvider, toast } from "@0xtrou/cozy-ui";

export default function App() {
  return (
    <TooltipProvider>
      <Toaster />
      <Button variant="reward" onClick={() => toast.success("Harvested!")}>Harvest</Button>
    </TooltipProvider>
  );
}
  • On Tailwind CSS v4: import @0xtrou/cozy-ui/cozy.css instead of styles.css.
  • Pay only for what you use: components are separate ES modules. A Button-only app adds about 11 KB gzip. You can also import one directly: @0xtrou/cozy-ui/button.

shadcn/ui project: own the code

Best when you want to customise. Needs shadcn/ui with Tailwind CSS v4; run npx shadcn@latest init first if you have no components.json.

1. Add the registry

components.json
{
  "registries": {
    "@cozy": "https://cozy-ui.solo.engineer/r/{name}.json"
  }
}

2. Add the theme, font and components

npx shadcn@latest add @cozy/cozy-theme @cozy/button @cozy/card
npm install @fontsource/nunito

3. Import the styles

In your global CSS file, after the shadcn variables, so the cozy palette wins. cozy-theme writes styles/cozy.css; use the relative path to it:

app/globals.css
@import "@fontsource/nunito/400.css";
@import "@fontsource/nunito/200.css";
@import "./styles/cozy.css";

body {
  background: var(--cz-page);
  color: var(--cz-text);
  font-family: var(--cz-font-family);
}
No CLI? Copy cozy.css by hand

Then copy component files from each page's Manual tab. They need radix-ui, class-variance-authority, clsx, tailwind-merge (and sonner for toasts).

styles/cozy.css
/* Loading… */

Any stack: CSS only

For Vue, Svelte, server-rendered pages or a quick prototype. You get the look and motion; behaviour such as dialogs, menus and focus is yours to add.

index.html
<link rel="stylesheet" href="https://unpkg.com/@0xtrou/cozy-ui/dist/fonts.css" />
<link rel="stylesheet" href="https://unpkg.com/@0xtrou/cozy-ui/dist/cozy.css" />

<button class="cz-button cz-button--reward">Harvest</button>
<div class="cz-card"><div class="cz-card__title">Rice field</div></div>

AI assistant: MCP server

Your assistant looks up components, props and install commands from the real docs, so it writes working code the first time.

claude mcp add cozy-ui -- npx -y @0xtrou/cozy-ui-mcp

Cursor, VS Code, mcpfs and other clients: see MCP server.

Game team: Unity UI Toolkit

Keep one visual language between your web pages and your game. Tokens become USS variables and class names stay the same: Unity guide.

Designer: tokens

@0xtrou/cozy-ui/tokens.json holds radius, depth, shadows, spacing, type, motion and the five palettes. See Tokens and Palettes.

Choose a palette

Every path: set <html data-palette="meadow">, or leave it out to follow the system (Village by day, Lantern at night).