---
name: defuss-shadcn
description: Build UI prototypes and pages with defuss-shadcn - shadcn-style components as semantic HTML + design tokens + plain CSS + small vanilla ES modules (no framework, no Tailwind, no React). Use when an agent must generate or edit HTML/UI (forms, dialogs, menus, tables, charts, slide decks, marketing sections) - in a package-managed web project or as a standalone HTML prototype.
---

<!-- GENERATED by scripts/lib/skill-files.ts on every build (from src/SKILL_root_tpl.md,
     src/documentation/lib/nav.ts, each page's .mdx frontmatter and each component's
     component-skill.md frontmatter) - do not edit by hand; edit a source and rebuild. -->

# defuss-shadcn {{VERSION}} - Agent Skill

{{TOTAL}} components ({{CSS_ONLY}} CSS-only, {{WITH_JS}} with a small ES module) built on native HTML elements, themed entirely by CSS custom properties (tweakcn-compatible tokens). You write **plain HTML markup** with the documented classes and `data-*` attributes; the shipped CSS styles it and the shipped JS wires behavior from those attributes. There is nothing to compile.

## 0. Quick start - do exactly this, in this order

1. **Pick the install path** (there are only two - see §1):
   - The target project has a `package.json` / package manager: take **Path A: npm**.
   - No package manager, or the goal is a standalone `.html` prototype: take **Path B: jsDelivr CDN** (plain HTML, **no TypeScript, no build step**).
2. **Include exactly three files, in this order:**
   1. `components/core.css` - design tokens + the layout/sizing/accessibility utilities the examples use (`flex`, `gap-4`, `stack`, `sr-only` ...),
   2. `components/all.css` - every component's styles,
   3. `components/all.js` as an ES module - the `df$` runtime + every component's behavior.
   (`all.css` holds component styles only: without `core.css` there are no tokens and no utilities.)
   Four extra bundles are NOT in `all.*` - add a pair after them only where the page uses their components: `components/wysiwyg.css` + `.js` (the HTML Preview Editor `code-example`, `editorjs`), `components/mermaid.css` + `.js` (`mermaid`), `components/math.css` + `.js` (`math-renderer`, `math-editor`, `math-compute`), `components/visual-editor.css` + `.js` (`visual-editor`).
3. **For each component you use:** open its skill (index in §4), copy the **Structure** markup verbatim, then pick variants/sizes via `data-variant` / `data-size`. Never invent class names.
4. **Need a state** (open dialog, expanded tree, selected tab)? Author it in markup, or call `el.api.setState('<state>')` - never toggle classes.
5. **Serve over HTTP** (`npx serve .` or the project's dev server). ES modules do not run from `file://`.

Everything else in this file is lookup: §2 rules, §3 documentation map (guides + examples), §4 component index (why/when + links).

**Where the files are - read them, do not search the filesystem.** All paths are relative to the folder of this SKILL.md:

- **Component skills** (markup, variants, sizes, ARIA, states - what every task needs): `references/components/<name>.md`, next to this file in every install. §4 links each one.
- **Documentation pages** (guides + live examples, MDX) and the shipped **CSS/JS**: two levels up, `../../src/documentation/pages/<page>.mdx` and `../../dist/components/…` - present when the skill came with the package (Claude Code plugin, npm install).
- **Not there?** (a skills-CLI install copies only this folder): fetch the same path from `{{RAW_BASE}}` + the path without `../../` (this release's tag, raw text), e.g. `{{RAW_BASE}}src/documentation/pages/button.mdx`.

## 1. Install

### Path A - package manager (npm, bun, pnpm, yarn)

```bash
npm install defuss-shadcn        # or: bun add defuss-shadcn / pnpm add defuss-shadcn / yarn add defuss-shadcn
```

Import the files through the project's bundler (Vite, webpack, Rollup, Parcel, esbuild, Bun) - side-effect imports, **in this order**, once, in the app entry:

```js
// everything (simplest): tokens + utilities → all component CSS → runtime + all behavior
import 'defuss-shadcn/dist/components/core.css';
import 'defuss-shadcn/dist/components/all.css';
import 'defuss-shadcn/dist/components/all.js';
```

```js
// or modular (smaller): core first, then only the components you use
import 'defuss-shadcn/dist/components/core.css';          // tokens + sizing + layout + accessibility utilities
import 'defuss-shadcn/dist/components/button/button.css';
import 'defuss-shadcn/dist/components/dialog/dialog.css';
import 'defuss-shadcn/dist/components/core.js';           // installs df$ - MUST precede every component .js
import 'defuss-shadcn/dist/components/dialog/dialog.js';  // only interactive components ship a .js
```

- The package ships plain `.css` and ESM `.js` - no framework plugin, no typings, no build config. The bundler only resolves the paths.
- `all.js` already contains `core.js`: never import both.
- Optional opt-in stylesheet: `defuss-shadcn/dist/theme/utils/shapes.css` (corners, `shape-*` silhouettes - every DaisyUI `mask-*` shape under the same name as `shape-*` - section edges, stylized shadows, frames, patterns).
- Charts need Apache ECharts on `globalThis.echarts` before a chart mounts (`npm install echarts`, then `import * as echarts from 'echarts'; globalThis.echarts = echarts;`).
- Icons: only if you use `<i data-lucide="name">` - `npm install lucide`, then `import { createIcons, icons } from 'lucide'; createIcons({ icons });`.

### Path B - jsDelivr CDN (standalone HTML prototype, no package manager, no TypeScript)

Copy this skeleton and put component markup inside `<body>`. Replace `@latest` with `@{{VERSION}}` to pin the release.

```html
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Prototype</title>
  <!-- 1. tokens + layout/sizing/accessibility utilities -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/kyr0/defuss-shadcn@latest/dist/components/core.min.css">
  <!-- 2. every component's CSS -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/kyr0/defuss-shadcn@latest/dist/components/all.min.css">
</head>
<body>
  <!-- your markup, copied from the component skills -->

  <!-- 3. df$ runtime + every component's behavior (ES module) -->
  <script type="module" src="https://cdn.jsdelivr.net/gh/kyr0/defuss-shadcn@latest/dist/components/all.min.js"></script>
  <!-- 4. icons - only if you use <i data-lucide="…"> -->
  <script src="https://unpkg.com/lucide@1.8.0"></script>
  <script>lucide.createIcons();</script>
</body>
</html>
```

- Modular variant: keep `core.min.css`, replace `all.min.css` with one `components/{name}/{name}.min.css` per component, and replace `all.min.js` with `components/core.min.js` followed by `components/{name}/{name}.min.js` for each interactive component (core first, always).
- Opt-in shapes: `dist/theme/utils/shapes.css` after `core.min.css`.
- Charts: add `<script src="https://cdn.jsdelivr.net/npm/echarts@6.1.0/dist/echarts.min.js"></script>` before any chart markup.
- Dark mode: add `class="dark"` to `<html>`. Themes: add one `dist/theme/{preset}.css` (43 tweakcn presets, e.g. `bubblegum.css`) **after** `core.min.css` - it overrides the default tokens in light and dark.
- Serve the folder: `npx serve .` (or `python3 -m http.server`) and open the printed URL.

## 2. Rules - follow these, do not derail

- **Markup from the skills, verbatim.** Every component's `component-skill.md` has a Structure section: copy it, change only content and documented attributes. One base class per component (`.btn`, `.card`, `.dialog`); variants and sizes are `data-variant` / `data-size` / `data-side` - never modifier classes (`.btn-outline` does not exist).
- **Native elements first.** `<dialog>` for modals, the `popover` attribute for menus/tooltips, `<details>` for accordions/trees, native form controls. If you are about to write JavaScript for open/close/toggle/focus, the component already does it - re-read its skill.
- **Colors, radius, shadows, fonts come from tokens.** Use `var(--primary)`, `var(--border)`, `var(--radius-md)`, `var(--shadow-sm)` ... (the tweakcn set). Never hardcode brand colors into markup; re-theme by loading a preset from `dist/theme/` after core.
- **State through the State API.** Interactive components expose `el.api.setState(name, config?)` / `el.api.getState()` per element, plus `df$.shadcn.{name}Api` / `df$.shadcn.{name}States`. Supported state names are listed per component in §4.
- **One runtime: `df$`.** `core.js` (or `all.js`) installs the callable `df$` (defuss-query + defuss-morph) once; your own scripts may use it (`df$(sel).attr()`, `df$(container).morph(html)`), but never replace it and never define your own `window` globals. Imperative component APIs live under `df$.shadcn.*` (e.g. `df$.shadcn.toast.show({...})`).
- **Dynamic content just works.** Every component initializes new elements automatically (MutationObserver) - insert markup, no re-init call.
- **Layout helpers ship in `core.css`.** Sizing + layout + accessibility utilities (`flex`, `grid`, `stack`, `container`, `gap-4`, `p-6`, `w-full`, `sr-only` ...) - use them instead of inline layout CSS. `shapes.css` is opt-in.
- **Accessibility is built in.** Keep the ARIA attributes from the skill (roles, `aria-*`, labels with `for`); icon-only buttons need `aria-label`.

## 3. Documentation map - guides and live examples

Each link is the page's source (MDX: frontmatter + prose + ` ```html example ` fences whose body is the exact, working example markup). Open only what the task needs. Component pages are linked from the component index (§4) instead. A page shows whole examples; the smallest pieces - each component alone, in each variant, size and state the examples use - are in the component's parts file beside its sources (`src/components/<section>/<name>/<name>.parts.md`, ` ```html example part ` fences): take a single component from there, a whole composition from a page.

<!-- DOCS -->

## 4. Component index

Grouped like the documentation sidebar. **Type:** ATM atom · MOL molecule (composes atoms) · ORG organism · BLK page section · TPL whole page/deck. **JS** = ships an ES module (needs core/all); **CSS** = markup + CSS only.

<!-- COMPONENTS -->
