-
Notifications
You must be signed in to change notification settings - Fork 0
tokens and components
Registry-first means you run specui add before you write UI in React, Vue, SwiftUI, or anything else. It sounds bureaucratic; in practice it's the only thing that keeps the spec and the code from drifting apart. This guide covers every add kind and how they connect to TOKENS.yaml and manifests/registry.json.
- A
.specui/from Quick start orspecui init - A shell at the project root (the parent of
.specui/), or pass--specui <path>
npx specui add component primary-button \
--variants default,destructive,outline \
--states default,hover,focus,disabled,loadingThis creates:
.specui/components/primary-button/
MANIFEST.yaml
SPEC.md
VARIANTS.md
STATES.md
Names must be kebab-case. If you omit --states, you get the canonical default set.
-
SPEC.md— behavior, anatomy, accessibility -
VARIANTS.md— the variant matrix -
STATES.md— every interactive state (required for parity across platforms) -
MANIFEST.yaml—syncTargetsnotes per platform (web, ios, …)
npx specui get button --forceAdds a vendor/ folder under the component — see Registries.
npx specui add token color.brand.primary "#f54e00" --theme light
npx specui add token color.brand.primary "#ff6b2c" --theme dark
npx specui add token space.section.md "24px"Paths must be semantic (color.text.primary, not raw hex names). Themed colors use --theme.
add token merges into .specui/TOKENS.yaml. Editing the YAML by hand is fine too — just validate afterwards:
npx specui validate .specui --strictContrast checks run unless you pass --no-contrast. Document token roles in 02-foundations-tokens.md.
npx specui export --format css --theme light --to ./src/specui.css --from .specui
npx specui export --format tailwind --theme light --to ./specui.theme.js --from .specuiMore formats in Interop.
Four types: icon, illustration, photo, logo.
npx specui add asset logo acme-mark \
--sizes 16,24,32 \
--modes color,mono \
--link component:brand-markRegister assets before code references them. Link each one to a component, or document it as unassigned in the manifest.
Patterns describe multi-step UX — confirmations, empty states, validation flows:
npx specui add pattern destructive-confirmation
npx specui add pattern empty-stateEdit .specui/patterns/<name>.md using the template from AGENT-DESIGN-RULES.md.
npx specui sync
npx specui validate .specui --strict
npx specui list componentsCommit .specui/ together with the application code that implements the registration — one PR, one story.
SPEC.md lists componentsRequired and patternsRequired from your --preset. validate fails until those folders exist — either add them, or adjust the front matter to match reality.
From the repo root where SPEC.md lives:
npx specui add component chip --variants default
npx specui validate .Same add commands; path resolution uses the flat layout when SPEC.md is at the root.
- Validation
- Agents & MCP — agents must not skip registration
- CLI — add
Getting started
How-to guides
- Scenarios
- Tokens And Components
- Agents And Mcp
- Agent Prompts
- Ci Cd
- Distribution
- Registries
- Interop
- Designmd
- Validation
- Troubleshooting
Reference
Community