# ShadeUI — agent guide

Use this when building UI in any project that depends on `@shadeui/ui`, or when extending ShadeUI itself.

## Positioning

ShadeUI is the design system for product designers who ship — and for AI agents that ship with them. Prefer ShadeUI components over inventing equivalent Tailwind markup when a covered primitive exists.

## Install

```bash
npm install @shadeui/ui
```

```ts
import { BezelButton, DefaultInput, PointBadge } from '@shadeui/ui';
import '@shadeui/ui/styles.css';
```

## Covered components (use these first)

| Export | Family | When to use |
|--------|--------|-------------|
| `Accordion` | Accordion | Expandable section; `variant` rounded \| sharp |
| `Alert` | Alert | Status callout; accent / fill / outline |
| `Breadcrumbs` | Breadcrumbs | Path nav; slash / arrow / dotted |
| `ButtonGroup` | Button group | Segmented control |
| `DatePicker` | Date picker | Single / range calendar panel |
| `DateInput` | Date picker | Field trigger for date selection |
| `Divider` | Divider | Line / text / button / icon-button |
| `Drawer` | Drawer | Side panel from a trigger; text / form / accordion; empty state with icon |
| `Header` | Header | Page header; title, icons, CTAs |
| `Navbar` | Website | Site navbar; bar layouts, dropdowns, mega menus, full-screen menus |
| `Footer` | Website | Site footer; tagline, newsletter, columns, socials |
| `CallToAction` | Website | Closing section; stacked, split, banner, inset, rail, duo, statement; plain or media |
| `Hero` | Website | Page hero and introduction; media, intro, split, actions; centered, start, or beside media |
| `Feature` | Website | Feature sections; overlays, media cards, alternating split, bento, icons, numbered list; optional eyebrow and description |
| `Gallery` | Website | Image gallery; grids, split, mosaic, slideshow, filmstrip |
| `PageIntro` | Website | Compatibility wrapper; use Hero intro / split / actions in new code |
| `LogoCloud` | Website | Static customer marks; rows, grid, marquee, split, or showcase; links only when supplied |
| `Testimonials` | Website | Quotes; single, cards, portrait, carousel |
| `Pricing` | Website | Plans; tiers, spotlight, comparison |
| `Careers` | Website | Open roles; departments, cards, list, board |
| `Team` | Website | People; portrait grid, cards, editorial, directory, compact |
| `Blog` | Website | Articles; featured, grid, or list |
| `BlogPost` | Website | Article header; cover or plain |
| `Contact` | Website | Contact; form, split, offices, channels, dialog |
| `Announcement` | Website | Site announcement; bar or panel |
| `Article` | Website | Long-form; prose, figure, or side note |
| `ProductDetail` | Website | Component spotlight; overview or specs |
| `ProductList` | Website | Library index; cards or rows |
| `Catalog` | Website | Filterable library; sidebar or toolbar |
| `Faq` | Website | FAQ block; sharp or rounded accordions |
| `LineChart` | Charts | Line chart card; Figma blue, SemanticsBadge trend, web/mobile, range dropdown |
| `BarChart` | Charts | Bar chart card; default / grouped / stacked, Figma blue, hover tip, web/mobile |
| `AreaChart` | Charts | Area chart card; dashed/solid grid, gradient fill, multi-series, web/mobile |
| `PieChart` | Charts | Pie / donut / stacked rings; mixed or mono palette, hover tip |
| `RadialChart` | Charts | Progress ring / full / semi radial; Active vs track, hover tip |
| `ChartHoverTooltip` | Charts | White chart hover pointer (not dark Tooltip) |
| `Message` | Message | Chat bubble; sent / received, avatar, reaction |
| `MessageList` | Message | Thread container for bubbles |
| `MessageStatus` | Message | Delivered / read line |
| `MessageTyping` | Message | “Thinking…” indicator |
| `Modal` | Modal | Centered dialog; status × alignment, don’t-show-again, blurred overlay |
| `Navigation` | Navigation | Sidebar; expand / collapse toggle, workspace + account menus, sections, widget |
| `SidebarItem` | Navigation | Sidebar row; fill / accent, icon-only, badge |
| `Pagination` | Pagination | Page controls; numbered / simple / detailed / compact |
| `Popover` | Popover | Click panel for text, menus, or forms with inputs (not hover Tooltip) |
| `Progress` | Progress | Linear / circular indicators; colour, value, tooltip |
| `ShimmeringText` | AI | Gradient shimmer for streaming / thinking labels |
| `Waveform` | AI | Voice / audio level bars |
| `Tabs` | Tabs | Tab group; line / folder / pill |
| `Table` | Table | Data table; leading cells, supporting cells, star rating, row menu |
| `Toggle` | Toggle | Switch; label, description, badge |
| `TooltipProvider` | Tooltip | Shared hover delay and skip-delay for a group of tips |
| `Tooltip` | Tooltip | Dark tip; size, arrow, description |
| `Checkbox` | Checkbox | Multi-select control; filled / outline |
| `Radio` | Radio | Single-select control; filled / outline |
| `BezelButton` | Button | Primary elevated actions |
| `FlatButton` | Button | Secondary filled actions |
| `LinkButton` | Button | Text / low-emphasis actions |
| `PointBadge` | Badge | Compact status with point option |
| `SemanticsBadge` | Badge | Figma Semantics Badge; table status cells |
| `SolidBadge` | Badge | Filled status chips |
| `StatusBadge` | Badge | Semantic status (success / danger / warning) |
| `RoundBanner` | Banner | Rounded announcements |
| `SharpBanner` | Banner | Sharp-edged announcements |
| `DefaultInput` | Input | Single-line fields |
| `TextArea` | TextArea | Multi-line fields |
| `Avatar` | Avatar | Image, letters, or profile placeholder |
| `AvatarGroup` | Avatar | Stacked avatars with +N overflow |

Use `LineChart` / `BarChart` / `AreaChart` / `PieChart` / `RadialChart` + `ChartHoverTooltip` for shipped data viz. Use `Message*` + `ShimmeringText` + `Waveform` + `Popover` for AI product chrome. Prefer Templates → AI Agent for a composed thread.

## Tokens

Components use CSS variables from `@shadeui/ui/styles.css`. Prefer **semantic** tokens for chrome that should flip with light/dark (`--shadeui-bg`, `--shadeui-fg`, `--shadeui-surface`, `--shadeui-border`, …) and for shared foundations (`--shadeui-font-sans`, `--shadeui-radius-md`, `--shadeui-overlay`). Use **palette** tokens for brand/status accents (`--shadeui-color-blue-600`, `--shadeui-color-red-800`, …).

Do not hardcode hex for colors that already exist as ShadeUI tokens. Do not hardcode a webfont in components — set `--shadeui-font-sans` in the host app.

**Only reference tokens defined in `src/styles/tailwind.css`** (`@theme` palette or `:root` / `.dark` semantic). Names like `--shadeui-color-text-700` or `--shadeui-color-white` (without a step) are invalid — undefined `var()` silently falls back and breaks contrast. `src/styles/tokens.test.ts` fails CI/local `npm test` if a component references a missing token.

## Figma

Design source: [Shade UI Design System V1.2](https://www.figma.com/design/Xf3xOmGv9EfXWtt8ezQHj6/Shade-UI-Design-System-V1.2)

Code Connect maps live next to components as `*.figma.tsx`. Publish with `FIGMA_ACCESS_TOKEN` and `npm run figma:connect` (requires Figma Code Connect on the org plan).

## Docs

Storybook (playground + docs): `npm run storybook`

## AI / agents

- Prefer this file (`AGENTS.md`) as the system brief for Cursor rules and other agents. It ships with `@shadeui/ui` (alongside `llms.txt`).
- Component docs expose **Copy page** (Markdown + Open in Cursor / Antigravity / v0 / ChatGPT / …).
- Templates keep **Open** for blocks. AI Agent template composes Message + AI primitives.
- Setup: Storybook **Guides → AI agents**. Run `npx @shadeui/ui init` in consumer apps so AGENTS.md, the ShadeUI skill, and MCP land in the project.

### Hosted MCP (`shadeui`)

Query live component docs without running Storybook:

```text
https://www.shadeui.dev/mcp
```

```bash
npx @shadeui/ui init
npx @shadeui/ui mcp
```

Tools: `list_components`, `get_component`, `list_templates`, `get_setup`, `get_motion`, `validate_component_usage`. Call them before inventing props.

### Storybook MCP (`shadeui-sb-mcp`)

When Storybook is running locally (`http://localhost:6006/mcp`), use its docs tools for full stories and examples:

- **CRITICAL: Never hallucinate component properties!** Before using ANY property, call MCP docs tools to confirm it exists.
- `list-all-documentation` — index of components and docs pages
- `get-documentation` — props, examples, and related stories for one component
- `get-documentation-for-story` — full detail for a specific story when the overview isn’t enough
- `get-storybook-story-instructions` — current conventions for writing/updating stories
- Prefer documented props and story examples only; if something isn’t documented, ask rather than assume patterns from other libraries.

## Do / don’t

- **Do** import from `@shadeui/ui` and reuse existing props (`color`, `size`, `label`, loading states).
- **Do** match Figma variant names when mapping props.
- **Don’t** rebuild Bezel/Flat/Link buttons with ad-hoc Tailwind.
- **Don’t** invent components that aren’t shipped yet — extend Storybook when new ones land.
- **Don’t** use Tooltip for click menus — use `Popover`.


## Motion and screen composition

Use the shipped ShadeUI skill's screen workflow: discover templates, inspect component docs, compose with semantic tokens, then verify real interaction states and accessibility. This is the agent integration for composing ShadeUI interfaces; it does not provide a hosted chat service.

Motion confirms actions and preserves spatial continuity. Buttons provide press feedback; overlays enter and exit with interruptible transitions; popovers scale from the trigger edge; accordions rotate their indicator and fade their content; toggles move their thumb. Do not add a second entrance animation to these components.

Shared tokens in `src/styles/tailwind.css`: `--shadeui-duration-fast` (120ms), `--shadeui-duration-normal` (200ms), `--shadeui-duration-exit` (160ms), `--shadeui-ease-out`, `--shadeui-press-scale` (0.97). Use transform/opacity, avoid delayed keyboard highlights, and honor reduced motion. Call MCP `get_motion` for this guidance.

Wrap tooltip groups once in `TooltipProvider` (defaults: `delayDuration={250}`, `skipDelayDuration={300}`). Focus opens immediately; Escape closes. Standalone `Tooltip` keeps immediate hover for compatibility. Line-tab indicators slide on pointer selection; keyboard selection is immediate.


## Source-derived APIs and usage checks

`get_component` now reads a generated TypeScript API manifest: explicit prop types, required inputs, literal options, inherited native prop names, and referenced local types. `list_components` lists the actual component exports.

Use `validate_component_usage` with a serializable component plan and referenced tokens, fix its reported issues, then check the app with TypeScript and a browser. It checks names, required props, literal choices, simple types, and token existence. It explicitly leaves nested types, callbacks, React elements, accessibility, and layout unchecked. A valid plan is not proof of a production-ready screen.

Maintainers: run `npm run generate:api` after API or token changes. `npm run check:api` detects stale generated docs; package builds regenerate them.

Charts start at their real values. Corresponding values transition; category/series replacements crossfade SVG data marks. Bars animate via transforms. Hover details remain immediate; reduced motion skips interpolation, fades, and loading pulses. Use each chart’s existing Storybook Controls panel to change data and the `animated` prop.

Charts accept `animated` (default `true`); set `animated={false}` to disable data transitions and dataset replacement fades. Reduced motion remains automatic. Reuse Tailwind utilities through `className` and the shared motion tokens instead of inventing a separate ShadeUI animation utility API. Custom interaction rules use the components CSS layer so Tailwind utilities can override them.
