open-design/design-systems/shadcn/components.html
chaoxiaoche 788ce450fc
feat(design-systems): add tokens.css + components.html for 10 AI / devtool brands (#2023)
Brands added (each with full 56-token :root + self-contained fixture):
- Tier A (AI ecosystem): x-ai, perplexity, ollama, runwayml, minimax
- Tier B (AI-adjacent devtools): supabase, posthog, resend, shadcn, raycast

All 10 declare the complete shared schema (26 A1 + 26 A2 + 4 B-slot) with no
C-extensions; pnpm guard reports 27 brand pairs aligned end-to-end.

Co-authored-by: chaoxiaoche <chaoxiaoche@chaoxiaochedeMacBook-Pro.local>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-18 14:03:36 +08:00

732 lines
28 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>shadcn — reference components</title>
<meta
name="description"
content="Reference fixture for design-systems/shadcn. Every visible
value comes from tokens.css; the page itself follows shadcn's
rules — pure white canvas, slate-900 body text, black reserved
for the decisive CTA, 1px borders, 8px default radius, focus
rings with 2px offset, Geist Sans with restrained tracking."
/>
<style>
/* :root paste — sourced verbatim from design-systems/shadcn/tokens.css. */
:root {
--bg: #ffffff;
--surface: #ffffff;
--surface-warm: var(--surface);
--fg: #111827;
--fg-2: var(--fg);
--muted: #64748b;
--meta: var(--muted);
--border: #e5e7eb;
--border-soft: var(--border);
--accent: #000000;
--accent-on: #ffffff;
--accent-hover: color-mix(in oklab, var(--accent), white 10%);
--accent-active: color-mix(in oklab, var(--accent), white 18%);
--success: #16a34a;
--warn: #d97706;
--danger: #dc2626;
--font-display: "Geist", "Geist Sans", -apple-system, system-ui, "Segoe UI", Arial, sans-serif;
--font-body: "Geist", "Geist Sans", -apple-system, system-ui, "Segoe UI", Arial, sans-serif;
--font-mono: "Fira Code", ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Monaco, Consolas, monospace;
--text-xs: 12px;
--text-sm: 14px;
--text-base: 16px;
--text-lg: 20px;
--text-xl: 24px;
--text-2xl: 32px;
--text-3xl: 40px;
--text-4xl: 48px;
--leading-body: 1.5;
--leading-tight: 1.2;
--tracking-display: -0.02em;
--space-1: 4px;
--space-2: 8px;
--space-3: 12px;
--space-4: 16px;
--space-5: 20px;
--space-6: 24px;
--space-8: 32px;
--space-12: 48px;
--section-y-desktop: 96px;
--section-y-tablet: 64px;
--section-y-phone: 48px;
--radius-sm: 6px;
--radius-md: 8px;
--radius-lg: 12px;
--radius-pill: 9999px;
--elev-flat: none;
--elev-ring: 0 0 0 1px var(--border);
--elev-raised:
0 1px 2px 0 color-mix(in oklab, var(--fg), transparent 92%),
0 1px 3px 0 color-mix(in oklab, var(--fg), transparent 88%);
--focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
--motion-fast: 150ms;
--motion-base: 200ms;
--ease-standard: cubic-bezier(0.2, 0, 0, 1);
--container-max: 1280px;
--container-gutter-desktop: 24px;
--container-gutter-tablet: 16px;
--container-gutter-phone: 16px;
}
/* ─── Reset (minimal) ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
background: var(--bg);
color: var(--fg);
font-family: var(--font-body);
font-size: var(--text-base);
line-height: var(--leading-body);
font-weight: 400;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
}
/* ─── Layout primitives ─────────────────────────────────── */
.container {
max-width: var(--container-max);
margin-inline: auto;
padding-inline: var(--container-gutter-desktop);
}
section {
padding-block: var(--section-y-desktop);
}
section + section {
border-top: 1px solid var(--border);
}
@media (max-width: 1023px) {
.container { padding-inline: var(--container-gutter-tablet); }
section { padding-block: var(--section-y-tablet); }
}
@media (max-width: 639px) {
.container { padding-inline: var(--container-gutter-phone); }
section { padding-block: var(--section-y-phone); }
}
/* ─── Typography ───────────────────────────────────────────
* Hierarchy comes from size + weight + tracking — never from
* color. shadcn headings stay on --fg; the accent color is
* reserved for the decisive CTA. */
h1, h2, h3, h4 {
font-family: var(--font-display);
line-height: var(--leading-tight);
letter-spacing: var(--tracking-display);
margin: 0;
color: var(--fg);
}
h1 { font-size: var(--text-4xl); font-weight: 600; }
h2 { font-size: var(--text-2xl); font-weight: 600; }
h3 { font-size: var(--text-xl); font-weight: 600; letter-spacing: -0.01em; }
h4 { font-size: var(--text-lg); font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
.lede {
font-size: var(--text-lg);
line-height: 1.6;
color: var(--muted);
}
.body-muted { color: var(--muted); }
.body-sm { font-size: var(--text-sm); }
.body-meta { color: var(--muted); font-size: var(--text-sm); }
/* shadcn-style eyebrow: small uppercase mono, muted color,
tracked open — the "section signpost" pattern visible in
the shadcn/ui docs nav and primitive index. */
.eyebrow {
font-family: var(--font-mono);
font-size: var(--text-xs);
font-weight: 500;
line-height: 1;
color: var(--muted);
text-transform: uppercase;
letter-spacing: 0.08em;
}
.stack-2 > * + * { margin-block-start: var(--space-2); }
.stack-3 > * + * { margin-block-start: var(--space-3); }
.stack-4 > * + * { margin-block-start: var(--space-4); }
.stack-6 > * + * { margin-block-start: var(--space-6); }
/* ─── Buttons ───────────────────────────────────────────────
* Primary is black-on-white (the shadcn default Button). Hover
* lifts the fill toward gray (--accent-hover mixes white in)
* because pure black cannot darken visibly. Secondary uses a
* real 1px border — shadcn's "outline" variant — and the
* "ghost" variant is borderless with a subtle hover wash. */
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: var(--space-2);
padding: 8px 16px;
border: 1px solid transparent;
border-radius: var(--radius-sm);
font-family: var(--font-display);
font-size: var(--text-sm);
font-weight: 500;
line-height: 1.43;
cursor: pointer;
text-decoration: none;
background: transparent;
color: inherit;
transition:
background-color var(--motion-fast) var(--ease-standard),
border-color var(--motion-fast) var(--ease-standard),
color var(--motion-fast) var(--ease-standard),
box-shadow var(--motion-fast) var(--ease-standard);
}
.btn:focus-visible {
outline: none;
box-shadow: var(--focus-ring);
}
.btn-primary {
background: var(--accent);
color: var(--accent-on);
border-color: var(--accent);
}
.btn-primary:hover {
background: var(--accent-hover);
border-color: var(--accent-hover);
}
.btn-primary:active {
background: var(--accent-active);
border-color: var(--accent-active);
}
.btn-secondary {
background: var(--surface);
color: var(--fg);
border-color: var(--border);
}
.btn-secondary:hover {
background: color-mix(in oklab, var(--bg), var(--fg) 4%);
}
.btn-ghost {
background: transparent;
color: var(--fg);
padding-inline: var(--space-3);
}
.btn-ghost:hover {
background: color-mix(in oklab, var(--bg), var(--fg) 6%);
}
/* ─── Inputs ───────────────────────────────────────────────
* 1px border (shadcn never hides input edges in shadow). On
* focus the ring expands to the full --focus-ring stack and
* the border collapses into the inner halo. */
.field {
display: flex;
flex-direction: column;
gap: var(--space-2);
}
.field label {
font-size: var(--text-sm);
font-weight: 500;
color: var(--fg);
}
.field input {
padding: 8px 12px;
border: 1px solid var(--border);
border-radius: var(--radius-sm);
background: var(--surface);
color: var(--fg);
font-family: inherit;
font-size: var(--text-sm);
line-height: 1.43;
outline: none;
transition:
border-color var(--motion-fast) var(--ease-standard),
box-shadow var(--motion-fast) var(--ease-standard);
}
.field input::placeholder { color: var(--muted); }
.field input:hover { border-color: color-mix(in oklab, var(--fg), transparent 70%); }
.field input:focus-visible {
border-color: var(--accent);
box-shadow: var(--focus-ring);
}
.field-help {
font-size: var(--text-xs);
color: var(--muted);
}
/* ─── Cards ───────────────────────────────────────────────
* shadcn Card primitive: 1px border, 8px radius, padding 24px,
* whisper-soft elevation. The border carries the edge; the
* shadow only adds a hint of lift. No multi-layer glow. */
.card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-md);
padding: var(--space-6);
display: flex;
flex-direction: column;
gap: var(--space-3);
box-shadow: var(--elev-raised);
transition:
border-color var(--motion-base) var(--ease-standard),
box-shadow var(--motion-base) var(--ease-standard);
}
.card:hover {
border-color: color-mix(in oklab, var(--fg), transparent 75%);
box-shadow:
0 1px 3px 0 color-mix(in oklab, var(--fg), transparent 88%),
0 4px 10px -2px color-mix(in oklab, var(--fg), transparent 88%);
}
/* ─── Badges ───────────────────────────────────────────────
* shadcn Badge variants — default (filled accent), secondary
* (muted surface), outline (1px border), and state (success).
* Pill shape; small mono-uppercase optional label. */
.badge {
display: inline-flex;
align-items: center;
gap: var(--space-1);
padding: 2px 10px;
border: 1px solid transparent;
border-radius: var(--radius-pill);
font-size: var(--text-xs);
font-weight: 500;
line-height: 1.5;
font-family: var(--font-display);
}
.badge-default {
background: var(--accent);
color: var(--accent-on);
}
.badge-secondary {
background: color-mix(in oklab, var(--bg), var(--fg) 5%);
color: var(--fg);
}
.badge-outline {
background: transparent;
color: var(--fg);
border-color: var(--border);
}
.badge-success {
color: var(--success);
background: color-mix(in oklab, var(--success), white 88%);
}
.badge-dot {
width: 6px;
height: 6px;
border-radius: 50%;
background: currentColor;
}
/* ─── Links ───────────────────────────────────────────────
* shadcn links are underlined for accessibility; underline
* thickness lifts on hover. Color stays --fg (the docs voice
* — no chromatic distraction in body copy). */
a {
color: var(--fg);
text-decoration: underline;
text-underline-offset: 3px;
text-decoration-thickness: 1px;
transition: text-decoration-thickness var(--motion-fast) var(--ease-standard);
}
a:hover { text-decoration-thickness: 2px; }
a:focus-visible {
outline: none;
border-radius: 2px;
box-shadow: var(--focus-ring);
}
/* ─── Kbd ────────────────────────────────────────────────── */
kbd {
font-family: var(--font-mono);
font-size: var(--text-xs);
padding: 2px 6px;
border: 1px solid var(--border);
border-radius: var(--radius-sm);
background: var(--surface);
color: var(--fg);
box-shadow: 0 1px 0 var(--border);
}
/* ─── Distinctive: Install command block ─────────────────────
* The single most recognizable shadcn surface — a terminal-
* voiced CLI command with the `$` prompt and the package name
* highlighted. Uses Fira Code for the technical typeface, the
* surface tier for the panel, and a clickable copy affordance. */
.install-block {
margin-block-start: var(--space-8);
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--space-4);
padding: var(--space-4) var(--space-5);
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-md);
font-family: var(--font-mono);
font-size: var(--text-sm);
line-height: 1.5;
color: var(--fg);
box-shadow: var(--elev-raised);
}
.install-block .prompt {
color: var(--muted);
user-select: none;
margin-inline-end: var(--space-2);
}
.install-block .copy {
appearance: none;
background: transparent;
border: 1px solid var(--border);
border-radius: var(--radius-sm);
padding: 4px 10px;
font-family: var(--font-display);
font-size: var(--text-xs);
font-weight: 500;
color: var(--muted);
cursor: pointer;
transition:
background-color var(--motion-fast) var(--ease-standard),
color var(--motion-fast) var(--ease-standard),
border-color var(--motion-fast) var(--ease-standard);
}
.install-block .copy:hover {
color: var(--fg);
background: color-mix(in oklab, var(--bg), var(--fg) 4%);
}
.install-block .copy:focus-visible {
outline: none;
box-shadow: var(--focus-ring);
}
/* ─── Section-specific layout ─────────────────────────────── */
.hero {
text-align: left;
}
.hero .eyebrow { margin-block-end: var(--space-4); }
.hero h1 { max-width: 22ch; }
.hero .lede {
max-width: 56ch;
margin-block-start: var(--space-5);
}
.hero-actions {
display: flex;
gap: var(--space-3);
margin-block-start: var(--space-8);
align-items: center;
flex-wrap: wrap;
}
.hero-meta {
display: inline-flex;
align-items: center;
gap: var(--space-3);
margin-block-start: var(--space-6);
color: var(--muted);
font-size: var(--text-sm);
flex-wrap: wrap;
}
.features-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: var(--space-5);
margin-block-start: var(--space-8);
}
@media (max-width: 1023px) {
.features-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 639px) {
.features-grid { grid-template-columns: 1fr; }
}
.feature-icon {
width: 36px;
height: 36px;
display: inline-flex;
align-items: center;
justify-content: center;
border: 1px solid var(--border);
border-radius: var(--radius-sm);
color: var(--fg);
background: color-mix(in oklab, var(--bg), var(--fg) 3%);
}
.form-row {
display: grid;
grid-template-columns: 1.2fr 1fr;
gap: var(--space-12);
align-items: start;
margin-block-start: var(--space-8);
}
@media (max-width: 1023px) {
.form-row { grid-template-columns: 1fr; }
}
.form {
display: flex;
flex-direction: column;
gap: var(--space-4);
max-width: 440px;
padding: var(--space-6);
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-md);
box-shadow: var(--elev-raised);
}
.form-actions {
display: flex;
gap: var(--space-3);
margin-block-start: var(--space-2);
align-items: center;
}
.row-between {
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--space-3);
}
.icon { width: 16px; height: 16px; flex-shrink: 0; }
</style>
</head>
<body>
<main class="container">
<!-- ════════════════════════════════════════════════════════════
HERO — exercises: --text-4xl Geist W600 with -0.02em
tracking, .lede in --muted, .btn-primary (black-on-white),
.btn-secondary (1px border outline), .btn-ghost, the
install-block CLI panel (Fira Code voice), .badge-secondary,
kbd. Single-column layout — shadcn heroes don't asymmetric-
split; the page IS the column.
═══════════════════════════════════════════════════════════════ -->
<section class="hero" data-od-id="hero">
<p class="eyebrow">v0.1 · reference fixture · shadcn</p>
<h1>Build your own component library.</h1>
<p class="lede">
Beautifully-designed, accessible components you copy and paste
into your apps. Open source, customizable, and yours to extend —
this fixture paints from the same
<code style="font-family: var(--font-mono); font-size: 0.95em">:root</code>
block every shadcn artifact inlines into its first
<code style="font-family: var(--font-mono); font-size: 0.95em">&lt;style&gt;</code>.
</p>
<div class="hero-actions">
<a href="./tokens.css" class="btn btn-primary">
Get started
<svg
class="icon"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.75"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<path d="M5 12h14M13 6l6 6-6 6" />
</svg>
</a>
<a href="./DESIGN.md" class="btn btn-secondary">Browse components</a>
<a href="#install" class="btn btn-ghost">npx shadcn add</a>
</div>
<p class="hero-meta">
<span class="badge badge-secondary">
<span class="badge-dot" aria-hidden="true" style="color: var(--success)"></span>
56 tokens · open source · MIT
</span>
<span>Press <kbd></kbd> <kbd>K</kbd> to search the registry.</span>
</p>
<div class="install-block" id="install">
<span>
<span class="prompt" aria-hidden="true">$</span>npx shadcn@latest add button
</span>
<button type="button" class="copy" aria-label="Copy install command">Copy</button>
</div>
</section>
<!-- ════════════════════════════════════════════════════════════
FEATURE CARDS — exercises: .card (1px border + whisper-soft
--elev-raised), h3 with -0.01em tracking, .body-muted,
inline link, .feature-icon, .features-grid. Three cards
per row at desktop, collapses on mobile. Voice mirrors the
shadcn pitch: copy/paste, accessibility, your code not ours.
═══════════════════════════════════════════════════════════════ -->
<section data-od-id="features">
<div class="stack-3">
<p class="eyebrow">Why teams reach for it</p>
<h2 style="max-width: 28ch">
Primitives that read like your own code, not a dependency.
</h2>
<p class="lede" style="max-width: 60ch">
Every component lives in your project — fully typed, fully
owned. Tokens here, JSX in your repo, no version pinning,
no transitive surprises.
</p>
</div>
<div class="features-grid">
<article class="card">
<span class="feature-icon" aria-hidden="true">
<svg
class="icon"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.75"
stroke-linecap="round"
stroke-linejoin="round"
>
<rect x="3" y="3" width="7" height="7" rx="1.5" />
<rect x="14" y="3" width="7" height="7" rx="1.5" />
<rect x="3" y="14" width="7" height="7" rx="1.5" />
<rect x="14" y="14" width="7" height="7" rx="1.5" />
</svg>
</span>
<h3>Copy &amp; paste.</h3>
<p class="body-muted body-sm">
The CLI drops every primitive's source into your repo as
plain TSX. No bundle, no abstraction layer — what you see
is what ships.
</p>
<a href="./tokens.css" class="body-sm">Inspect the tokens →</a>
</article>
<article class="card">
<span class="feature-icon" aria-hidden="true">
<svg
class="icon"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.75"
stroke-linecap="round"
stroke-linejoin="round"
>
<circle cx="12" cy="12" r="9" />
<path d="M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18" />
</svg>
</span>
<h3>Accessible by default.</h3>
<p class="body-muted body-sm">
Built on Radix primitives. Keyboard navigation, focus
management, ARIA wiring — the boring-correct foundation
is included so you can ship the brand layer.
</p>
<a href="./DESIGN.md" class="body-sm">Read the spec →</a>
</article>
<article class="card">
<span class="feature-icon" aria-hidden="true">
<svg
class="icon"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.75"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M12 3v18M3 12h18" />
<circle cx="12" cy="12" r="3" />
</svg>
</span>
<h3>Themeable to the token.</h3>
<p class="body-muted body-sm">
Rebind
<code style="font-family: var(--font-mono); font-size: 0.92em">--accent</code>,
<code style="font-family: var(--font-mono); font-size: 0.92em">--radius-md</code>,
and the foreground ramp once — every primitive across
the page restyles with no per-component overrides.
</p>
<a href="./tokens.css" class="body-sm">See the token map →</a>
</article>
</div>
</section>
<!-- ════════════════════════════════════════════════════════════
FORM — exercises: .field with 1px-border inputs, focus-visible
swap to the --focus-ring (the 2px-offset shadcn signature),
.btn-primary and .btn-secondary reuse. Form sits inside its
own bordered card so the input edges read as recessed
beneath the form surface.
═══════════════════════════════════════════════════════════════ -->
<section data-od-id="form">
<p class="eyebrow">Form primitives</p>
<h2 style="margin-block-start: var(--space-3); max-width: 28ch">
Inputs inherit the same tokens.
</h2>
<div class="form-row">
<div class="stack-4">
<p class="body-muted" style="max-width: 50ch">
Focus rings, edges, placeholder color — all derive from
<code style="font-family: var(--font-mono); font-size: 0.95em">--accent</code>,
<code style="font-family: var(--font-mono); font-size: 0.95em">--border</code>,
and <code style="font-family: var(--font-mono); font-size: 0.95em">--muted</code>.
The submit button reuses
<code style="font-family: var(--font-mono); font-size: 0.95em">.btn-primary</code>
unchanged — black fill, white label, 6px radius.
</p>
<p class="body-muted body-sm">
No new token is introduced for this section. The form
card uses
<code style="font-family: var(--font-mono); font-size: 0.95em">--elev-raised</code>
directly so the focused input's ring reads as a clean
halo over the bordered surface.
</p>
<p class="body-meta">
Full reference at <a href="./tokens.css">tokens.css</a> ·
spec at <a href="./DESIGN.md">DESIGN.md</a>.
</p>
</div>
<form class="form" onsubmit="event.preventDefault();">
<div class="row-between">
<p class="eyebrow">Join the registry preview</p>
<span class="badge badge-success">
<span class="badge-dot" aria-hidden="true"></span>
Open
</span>
</div>
<div class="field">
<label for="email">Work email</label>
<input
id="email"
type="email"
placeholder="you@team.dev"
autocomplete="email"
required
/>
<p class="field-help">
We'll send the registry preview link and nothing else.
</p>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">
Get the preview
</button>
<button type="button" class="btn btn-secondary">
Maybe later
</button>
</div>
</form>
</div>
</section>
</main>
</body>
</html>