---
title: "Installation"
description: "Install defuss-shadcn - straight from the jsDelivr CDN into plain HTML, or with npm into a bundled project. No framework, no build step for the CDN path."
slug: "installation"
---

import { DocPage, PageHeader, SkillPanel, Example, ExampleLabel, ExampleHint, ExampleCode, SourceFiles, SourceNote, StatesSection, CodeBlock, CodeWindow, Terminal, Demo, DemoCode, ChangelogEntries, ArchBody, StatsClaim, StatsCards, PageOverlay, DocText, DocLink, H2, SkillField, SkillText, SkillRow, SkillGrid, Variant, ApiPill, Dim, CodeCard, TableCard } from "../../lib/components/index";

<DocPage meta={meta}>

<PageHeader slug="installation" title="Installation">
  Each component is a self-contained folder with a static component skill, a stylesheet, and a JavaScript file if needed. Two ways in: the jsDelivr CDN for plain HTML (no build step), or npm for projects that already have a package manager and bundler.
</PageHeader>

<h2 style="font-family:var(--font-display);font-size:1.5rem;font-weight:400;letter-spacing:-0.02em;margin:0 0 1rem;">Quick start</h2>

<p class="text-sm text-muted-foreground mb-6">All files are served via <DocLink href="https://www.jsdelivr.com" target="_blank">jsDelivr</DocLink> CDN directly from the GitHub repo. No download or install required - just reference the URLs in your HTML.</p>

<div class="flex flex-col gap-8">
  <div>
    <div class="flex items-center gap-3 mb-3">
      <span style="width:1.625rem;height:1.625rem;border-radius:50%;background:var(--primary);color:var(--primary-foreground);font-size:0.75rem;font-weight:600;display:flex;align-items:center;justify-content:center;flex-shrink:0;">1</span>
      <h3 style="margin:0;font-size:1rem;font-weight:500;">Add the base: tokens + utilities</h3>
    </div>
    <CodeWindow lang="html" title="index.html · head" code={"<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/gh/kyr0/defuss-shadcn@latest/dist/components/core.css\">\n\n<!-- optional: a theme preset AFTER core overrides the default tokens -->\n<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/gh/kyr0/defuss-shadcn@latest/dist/theme/bubblegum.css\">"} />
    <p class="text-sm text-muted-foreground mt-2"><code>core.css</code> defines every token for the default light and dark theme plus the sizing, layout and accessibility utilities the examples use (<code>flex</code>, <code>gap-4</code>, <code>stack</code>, <code>sr-only</code> ...). To switch themes, load one preset from <code>dist/theme/</code> after it - that's all the theme selector in this documentation site is doing. Compatible with <DocLink href="https://tweakcn.com" target="_blank">tweakcn.com</DocLink> theme exports.</p>
  </div>
  <div>
    <div class="flex items-center gap-3 mb-3">
      <span style="width:1.625rem;height:1.625rem;border-radius:50%;background:var(--primary);color:var(--primary-foreground);font-size:0.75rem;font-weight:600;display:flex;align-items:center;justify-content:center;flex-shrink:0;">2</span>
      <h3 style="margin:0;font-size:1rem;font-weight:500;">Add the icons</h3>
    </div>
    <CodeWindow lang="html" title="index.html · head" code={"<script src=\"https://unpkg.com/lucide@1.8.0\"></script>\n<script>lucide.createIcons();</script>"} />
    <p class="text-sm text-muted-foreground mt-2"><DocLink href="https://lucide.dev" target="_blank">Lucide</DocLink> provides ~1,500 icons via CDN. Use <code>&lt;i data-lucide="name"&gt;&lt;/i&gt;</code> anywhere in your HTML. The script replaces each element with an inline SVG on page load. See the <DocLink href="icon.html">Icon</DocLink> page for details.</p>
  </div>
  <div>
    <div class="flex items-center gap-3 mb-3">
      <span style="width:1.625rem;height:1.625rem;border-radius:50%;background:var(--primary);color:var(--primary-foreground);font-size:0.75rem;font-weight:600;display:flex;align-items:center;justify-content:center;flex-shrink:0;">3</span>
      <h3 style="margin:0;font-size:1rem;font-weight:500;">Add the components</h3>
    </div>
    <CodeWindow lang="html" title="index.html · head + body" code={"<!-- Everything at once: every component's CSS + the bundle (embeds the core runtime) -->\n<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/gh/kyr0/defuss-shadcn@latest/dist/components/all.css\">\n<script type=\"module\" src=\"https://cdn.jsdelivr.net/gh/kyr0/defuss-shadcn@latest/dist/components/all.js\"></script>\n\n<!-- ...or only what you need: per-component CSS, then core.js + per-component JS -->\n<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/gh/kyr0/defuss-shadcn@latest/dist/components/button/button.css\">\n<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/gh/kyr0/defuss-shadcn@latest/dist/components/dialog/dialog.css\">\n<script type=\"module\" src=\"https://cdn.jsdelivr.net/gh/kyr0/defuss-shadcn@latest/dist/components/core.js\"></script>\n<!-- JS - after core, when the component needs it -->\n<script type=\"module\" src=\"https://cdn.jsdelivr.net/gh/kyr0/defuss-shadcn@latest/dist/components/dialog/dialog.js\"></script>\n\n<!-- Only on a page that uses them: the extra bundles, after either set above -\n     wysiwyg (HTML Preview Editor, Editor.js), mermaid, math (formulas, editor, compute), visual-editor -->\n<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/gh/kyr0/defuss-shadcn@latest/dist/components/wysiwyg.css\">\n<script type=\"module\" src=\"https://cdn.jsdelivr.net/gh/kyr0/defuss-shadcn@latest/dist/components/wysiwyg.js\"></script>\n<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/gh/kyr0/defuss-shadcn@latest/dist/components/mermaid.css\">\n<script type=\"module\" src=\"https://cdn.jsdelivr.net/gh/kyr0/defuss-shadcn@latest/dist/components/mermaid.js\"></script>\n<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/gh/kyr0/defuss-shadcn@latest/dist/components/math.css\">\n<script type=\"module\" src=\"https://cdn.jsdelivr.net/gh/kyr0/defuss-shadcn@latest/dist/components/math.js\"></script>\n<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/gh/kyr0/defuss-shadcn@latest/dist/components/visual-editor.css\">\n<script type=\"module\" src=\"https://cdn.jsdelivr.net/gh/kyr0/defuss-shadcn@latest/dist/components/visual-editor.js\"></script>"} />
    <p class="text-sm text-muted-foreground mt-2">Two delivery modes, one implementation: <strong>load core plus the components you use, or load all alone</strong> - both include the <code>df$</code> runtime (defuss-query + defuss-morph) through core; documentation code is separate, and there is no framework or jQuery dependency. <code>all.css</code> / <code>all.js</code> bundle the core runtime plus every component but four groups kept out for their weight, each an extra bundle a page adds after <code>all.\*</code> where it uses them: <code>wysiwyg.\*</code> (the HTML Preview Editor and Editor.js), <code>mermaid.\*</code>, <code>math.\*</code> and <code>visual-editor.\*</code>. This documentation loads <code>all.\*</code> and <code>wysiwyg.\*</code> on every page - every live example is an HTML Preview Editor - and <code>mermaid.\*</code> on the pages with a diagram of their own; an example loads what it uses inside its preview. Prefer a smaller payload? Load <code>core.js</code> once, then pick per-component <code>.css</code> + <code>.js</code> files from <code>components/\{name\}/</code> - a component script without core fails fast with one actionable load-order error. In between, a <DocLink href="bundles.html">section bundle</DocLink> loads one sidebar section at a time - the forms, the overlays, the website blocks - and every section also comes as a ZIP to vendor.</p>
  </div>
  <div>
    <div class="flex items-center gap-3 mb-3">
      <span style="width:1.625rem;height:1.625rem;border-radius:50%;background:var(--primary);color:var(--primary-foreground);font-size:0.75rem;font-weight:600;display:flex;align-items:center;justify-content:center;flex-shrink:0;">4</span>
      <h3 style="margin:0;font-size:1rem;font-weight:500;">Read the component skill, write the HTML</h3>
    </div>
    <CodeWindow lang="html" title="index.html · body" code={"<button class=\"btn\" data-variant=\"default\"\n        data-dialog-trigger=\"confirm\"\n        aria-haspopup=\"dialog\">\n  Open Dialog\n</button>\n\n<dialog id=\"confirm\" class=\"dialog\"\n        role=\"dialog\" aria-modal=\"true\"\n        aria-labelledby=\"confirm-title\">\n  <div class=\"dialog-content\">\n    <div class=\"dialog-header\">\n      <h2 class=\"dialog-title\" id=\"confirm-title\">Are you sure?</h2>\n      <p class=\"dialog-description\">This action cannot be undone.</p>\n    </div>\n    <div class=\"dialog-footer\">\n      <button class=\"btn\" data-variant=\"outline\" data-dialog-close>Cancel</button>\n      <button class=\"btn\" data-variant=\"default\">Confirm</button>\n    </div>\n  </div>\n</dialog>"} />
    <p class="text-sm text-muted-foreground mt-2">Each component folder has a <code>component-skill.md</code> that documents the exact HTML structure, attributes, variants, and ARIA. Read it, copy the pattern, fill in your content. The CSS and JS handle the rest.</p>
  </div>
  <div>
    <div class="flex items-center gap-3 mb-3">
      <span style="width:1.625rem;height:1.625rem;border-radius:50%;background:var(--primary);color:var(--primary-foreground);font-size:0.75rem;font-weight:600;display:flex;align-items:center;justify-content:center;flex-shrink:0;">5</span>
      <h3 style="margin:0;font-size:1rem;font-weight:500;">That's it</h3>
    </div>
    <p class="text-sm text-muted-foreground">Serve your HTML via any local server (e.g. <code>npx serve</code>). ES modules require HTTP - they don't run from <code>file://</code>. Dark mode toggles automatically when you add <code>class="dark"</code> to <code>&lt;html&gt;</code>.</p>
  </div>
</div>

<div style="margin-top:3rem;padding-top:2rem;border-top:1px solid var(--border);">
  <h2 style="font-family:var(--font-display);font-size:1.5rem;font-weight:400;letter-spacing:-0.02em;margin:0 0 0.75rem;">With a package manager</h2>
  <p class="text-sm text-muted-foreground mb-3">In a project that already has a package manager and a bundler (Vite, webpack, Rollup, Parcel, esbuild, Bun), install the package and import the same files in the same order - side-effect imports, once, in the app entry. The package ships plain CSS and ES modules; the bundler only resolves the paths.</p>
  <Terminal commands={"npm install defuss-shadcn   # or: bun add / pnpm add / yarn add defuss-shadcn"} />
  <CodeWindow lang="javascript" title="main.js" code={"// everything: tokens and utilities, then all component CSS, then the runtime and all behavior\nimport 'defuss-shadcn/dist/components/core.css';\nimport 'defuss-shadcn/dist/components/all.css';\nimport 'defuss-shadcn/dist/components/all.js';\n\n// ...or only what you need (core.js MUST precede every component .js)\nimport 'defuss-shadcn/dist/components/core.css';\nimport 'defuss-shadcn/dist/components/dialog/dialog.css';\nimport 'defuss-shadcn/dist/components/core.js';\nimport 'defuss-shadcn/dist/components/dialog/dialog.js';"} />
  <p class="text-sm text-muted-foreground mt-2">Icons and charts stay separate packages: <code>npm install lucide</code> (then <code>createIcons(&#123; icons &#125;)</code>) for <code>&lt;i data-lucide&gt;</code>, and <code>npm install echarts</code> assigned to <code>globalThis.echarts</code> before a chart mounts. For AI agents, the package's <code>skills/defuss-shadcn/SKILL.md</code> condenses both install paths, the rules, and an index of every component skill and documentation page - install it into your coding agent with one command (see <DocLink href="vibe-coding.html#install-as-an-ai-agent-skill">Vibe Coding / Agentic Engineering</DocLink>).</p>
</div>

<div style="margin-top:3rem;padding-top:2rem;border-top:1px solid var(--border);">
  <h2 style="font-family:var(--font-display);font-size:1.5rem;font-weight:400;letter-spacing:-0.02em;margin:0 0 0.75rem;">With an AI coding agent</h2>
  <p class="text-sm text-muted-foreground">Building with Claude Code, Codex, Cursor, Gemini CLI, Copilot or Windsurf? Install the <code>defuss-shadcn</code> Agent Skill and let the agent write the HTML - see <DocLink href="vibe-coding.html">Vibe Coding / Agentic Engineering</DocLink> for the one-command installs, updates and how to prompt it.</p>
</div>

<div style="margin-top:3rem;padding-top:2rem;border-top:1px solid var(--border);">
  <h2 style="font-family:var(--font-display);font-size:1.5rem;font-weight:400;letter-spacing:-0.02em;margin:0 0 0.75rem;">Pinning a version</h2>
  <p class="text-sm text-muted-foreground mb-3">Replace <code>@latest</code> with a specific version tag to lock your project to a release:</p>
  <CodeWindow lang="html" title="index.html · head" code={"<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/gh/kyr0/defuss-shadcn@v0.10.2/dist/theme/utils/default-semantic-tokens.css\">"} />
  <p class="text-sm text-muted-foreground mt-2">This ensures your project won't break when new versions are published. Check the <DocLink href="https://github.com/kyr0/defuss-shadcn/tags" target="_blank">releases page</DocLink> for available versions.</p>
</div>

<div style="margin-top:3rem;padding-top:2rem;border-top:1px solid var(--border);">
  <h2 style="font-family:var(--font-display);font-size:1.5rem;font-weight:400;letter-spacing:-0.02em;margin:0 0 0.75rem;">Self-hosting</h2>
  <p class="text-sm text-muted-foreground mb-3">Download the full system and drop it into any project. All the files are static - no build step, no dependencies. Point an AI at the folder and it has everything it needs: component skills to read, CSS to include, JS to wire up, and this entire documentation site with working examples of every component.</p>
  <p class="mb-4">
    <a href="https://github.com/kyr0/defuss-shadcn/archive/refs/heads/main.zip" class="btn" data-variant="outline" style="text-decoration:none;"><i data-lucide="download" style="width:1rem;height:1rem;" /> Download latest (.zip)</a>
  </p>
</div>

<div style="margin-top:3rem;padding-top:2rem;border-top:1px solid var(--border);">
  <h2 style="font-family:var(--font-display);font-size:1.5rem;font-weight:400;letter-spacing:-0.02em;margin:0 0 0.75rem;">Component folder structure</h2>
  <CodeWindow title="dist/components" numbers={false} code={"components/\n├-- core.css                # the theme base: tokens + sizing + layout + accessibility\n├-- core.js                 # the runtime: defuss-morph + defuss-query + shared layer\n├-- core.min.js             # minified runtime (same payload all.js embeds first)\n├-- all.css                 # bundle: every component stylesheet (readable)\n├-- all.min.css             # minified bundle\n├-- all.min.css.map\n├-- all.js                  # bundle: core runtime + every component's behavior (readable)\n├-- all.js.map              # source map back to the .ts sources\n├-- all.min.js              # minified bundle\n├-- all.min.js.map\n├-- wysiwyg.css / .js       # extra bundle: HTML Preview Editor + Editor.js (not in all.*)\n├-- mermaid.css / .js       # extra bundle: Mermaid (not in all.*)\n├-- math.css / .js          # extra bundle: the Math section (not in all.*)\n├-- visual-editor.css / .js # extra bundle: the Visual Editor (not in all.*)\n├-- geo.css / .js           # extra bundle: the Geo Map (not in all.*)\n├-- shaders.css / .js       # extra bundle: the Shader effects (not in all.*)\n└-- dialog/\n    ├-- component-skill.md  # HTML structure, attributes, ARIA (read this first)\n    ├-- dialog.css          # stylesheet (include via <link>)\n    ├-- dialog.min.css      # minified stylesheet\n    ├-- dialog.js           # interaction behavior (needs core.js first)\n    ├-- dialog.js.map       # source map for dialog.js\n    ├-- dialog.min.js       # minified behavior\n    └-- dialog.min.js.map   # source map for dialog.min.js"} />
  <p class="text-sm text-muted-foreground mt-2">Some components - like Button and Badge - are CSS-only. No JavaScript needed.</p>
</div>

<div style="margin-top:3rem;padding-top:2rem;border-top:1px solid var(--border);">
  <h2 style="font-family:var(--font-display);font-size:1.5rem;font-weight:400;letter-spacing:-0.02em;margin:0 0 0.75rem;">Minified builds &amp; source maps</h2>
  <p class="text-sm text-muted-foreground mb-3">Every component also ships minified twins, generated at build time with <DocLink href="https://oxc.rs" target="_blank">oxc-minify</DocLink> (JS) and <DocLink href="https://lightningcss.dev" target="_blank">Lightning CSS</DocLink> (CSS). Swap the extension to <code>.min.css</code> / <code>.min.js</code> in any URL:</p>
  <CodeWindow lang="html" title="index.html · head" code={"<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/gh/kyr0/defuss-shadcn@latest/dist/components/dialog/dialog.min.css\">\n<script type=\"module\" src=\"https://cdn.jsdelivr.net/gh/kyr0/defuss-shadcn@latest/dist/components/dialog/dialog.min.js\"></script>"} />
  <p class="text-sm text-muted-foreground mt-2">Minification changes no behavior - the State API (<code>el.api.setState()</code>), globals and <code>data-\*</code> attributes work identically. Debugging stays intact: <code>dialog.js.map</code> maps the readable file back to its source and <code>dialog.min.js.map</code> maps the minified file through it; devtools pick both up automatically via <code>sourceMappingURL</code>, so you can set breakpoints in the original source even when loading the <code>.min.js</code>.</p>
  <p class="text-sm text-muted-foreground" style="margin-top:0.75rem;">The bundle ships the same way: <code>all.min.css</code> (+ <code>all.min.css.map</code>) and <code>all.min.js</code> (+ <code>all.min.js.map</code>) are the minified twins of <code>all.css</code> / <code>all.js</code> - swap them in by URL alone:</p>
  <CodeWindow lang="html" title="index.html · head" code={"<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/gh/kyr0/defuss-shadcn@latest/dist/components/all.min.css\">\n<script type=\"module\" src=\"https://cdn.jsdelivr.net/gh/kyr0/defuss-shadcn@latest/dist/components/all.min.js\"></script>"} />
  <p class="text-sm text-muted-foreground" style="margin-top:0.75rem;">Readable and minified files ship from the same source per release, so you can mix them freely - minified in production, readable while developing - and switch back by URL alone.</p>
</div>

</DocPage>
