@create-ui/cli 0.5.8 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-RMTTHCB3.js → chunk-2ELKDGGM.js} +3 -3
- package/dist/{chunk-RMTTHCB3.js.map → chunk-2ELKDGGM.js.map} +1 -1
- package/dist/chunk-643QI2I2.js +102 -0
- package/dist/chunk-643QI2I2.js.map +1 -0
- package/dist/{chunk-NQFMXHMH.js → chunk-KQTXDVKV.js} +3 -3
- package/dist/chunk-KQTXDVKV.js.map +1 -0
- package/dist/index.d.ts +360 -360
- package/dist/index.js +26 -26
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/registry/index.d.ts +2 -2
- package/dist/registry/index.js +1 -1
- package/dist/schema/index.d.ts +715 -715
- package/dist/skills/createui/SKILL.md +199 -177
- package/dist/skills/createui/agents/openai.yml +1 -1
- package/dist/skills/createui/cli.md +42 -42
- package/dist/skills/createui/customization.md +20 -15
- package/dist/skills/createui/evals/evals.json +68 -5
- package/dist/skills/createui/mcp.md +14 -5
- package/dist/skills/createui/reference/accordion.md +127 -0
- package/dist/skills/createui/reference/app-store-badge.md +88 -0
- package/dist/skills/createui/reference/aspect-ratio.md +52 -0
- package/dist/skills/createui/reference/avatar.md +230 -0
- package/dist/skills/createui/reference/badge.md +110 -0
- package/dist/skills/createui/reference/breadcrumb.md +153 -0
- package/dist/skills/createui/reference/button-group.md +116 -0
- package/dist/skills/createui/reference/button.md +104 -0
- package/dist/skills/createui/reference/checkbox-group.md +118 -0
- package/dist/skills/createui/reference/checkbox.md +79 -0
- package/dist/skills/createui/reference/chip.md +115 -0
- package/dist/skills/createui/reference/close-button.md +83 -0
- package/dist/skills/createui/reference/country-flag.md +109 -0
- package/dist/skills/createui/reference/credit-card-input.md +76 -0
- package/dist/skills/createui/reference/date-input.md +71 -0
- package/dist/skills/createui/reference/dropdown-menu.md +164 -0
- package/dist/skills/createui/reference/field.md +186 -0
- package/dist/skills/createui/reference/info-tooltip.md +110 -0
- package/dist/skills/createui/reference/inline-alert.md +146 -0
- package/dist/skills/createui/reference/input-group.md +171 -0
- package/dist/skills/createui/reference/input-otp.md +130 -0
- package/dist/skills/createui/reference/input-stepper.md +120 -0
- package/dist/skills/createui/reference/input.md +118 -0
- package/dist/skills/createui/reference/label.md +121 -0
- package/dist/skills/createui/reference/pagination.md +157 -0
- package/dist/skills/createui/reference/phone-input.md +77 -0
- package/dist/skills/createui/reference/progress.md +158 -0
- package/dist/skills/createui/reference/radio-group.md +133 -0
- package/dist/skills/createui/reference/radio.md +79 -0
- package/dist/skills/createui/reference/scroll-area.md +212 -0
- package/dist/skills/createui/reference/segmented-control.md +146 -0
- package/dist/skills/createui/reference/select.md +204 -0
- package/dist/skills/createui/reference/separator.md +99 -0
- package/dist/skills/createui/reference/social-login-button.md +130 -0
- package/dist/skills/createui/reference/spinner.md +68 -0
- package/dist/skills/createui/reference/status-badge.md +89 -0
- package/dist/skills/createui/reference/switch-group.md +122 -0
- package/dist/skills/createui/reference/switch.md +75 -0
- package/dist/skills/createui/reference/tab-menu.md +165 -0
- package/dist/skills/createui/reference/text-link.md +84 -0
- package/dist/skills/createui/reference/textarea.md +50 -0
- package/dist/skills/createui/reference/toast.md +162 -0
- package/dist/skills/createui/reference/tooltip.md +63 -0
- package/dist/skills/createui/rules/composition.md +41 -25
- package/dist/skills/createui/rules/design.md +266 -0
- package/dist/skills/createui/rules/forms.md +44 -15
- package/dist/skills/createui/rules/icons.md +64 -18
- package/dist/skills/createui/rules/styling.md +53 -14
- package/dist/utils/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-M5DYT2NE.js +0 -64
- package/dist/chunk-M5DYT2NE.js.map +0 -1
- package/dist/chunk-NQFMXHMH.js.map +0 -1
|
@@ -1,210 +1,232 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: createui
|
|
3
|
-
description:
|
|
4
|
-
user-invocable:
|
|
3
|
+
description: Create UI component library and design system. Use whenever writing or editing ANY React/JSX UI - pages, views, components, layouts, styling - in a project that uses Create UI (has a components.json, the @createui registry, or @create-ui/* packages), and for createui CLI or MCP operations (init/add/create/diff/view/search/migrate/mcp). Provides per-component API references (reference/<component>.md), composition rules, semantic tokens, and design recipes.
|
|
4
|
+
user-invocable: true
|
|
5
5
|
allowed-tools: Bash(npx @create-ui/cli *), Bash(pnpm dlx @create-ui/cli *)
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Create UI
|
|
9
9
|
|
|
10
|
-
Create UI is a design code system: **one unified styling system + many themes**. Components are added as source code into the user's project via the `createui` CLI
|
|
10
|
+
Create UI is a design code system: **one unified styling system + many themes**. Components are added as source code into the user's project via the `createui` CLI and styled with Create UI's own semantic tokens. It is its own system - its own CLI (`npx @create-ui/cli`), its own registry (`@createui` - the only registry, never configure another), and its own component APIs. **Do not assume shadcn/ui conventions: the APIs differ.**
|
|
11
|
+
|
|
12
|
+
## Non-negotiable workflow
|
|
13
|
+
|
|
14
|
+
1. **Get project context** - `npx @create-ui/cli info` (prints components.json: aliases, `rsc`, `tailwind.css` path, `iconLibrary`). Use the real aliases in imports.
|
|
15
|
+
2. **Check installed components** - list the `ui` alias directory (e.g. `components/ui/`). Never import a component that hasn't been added; never re-add installed ones.
|
|
16
|
+
3. **Before the FIRST use of any component, read [`reference/<component>.md`](./reference/) in this skill folder.** It is generated from the component source and is the API authority (props, variants, defaults, icon usage, canonical example). If you cannot read it, fetch real usage instead: MCP `get_item_examples_from_registries` with `"<name>-demo"`, or `npx @create-ui/cli view <name>`.
|
|
17
|
+
4. **Add what's missing** - `npx @create-ui/cli add <name>`.
|
|
18
|
+
5. **Compose per the invariants below.** Never hand-roll a pattern listed in "Never hand-roll".
|
|
19
|
+
6. **Exercise the component API - never ship bare defaults.** Pick `variant` / `appearance` / `size` / `state` / `orientation` to fit each element's role on every build (see "Use the full component API" below). For marketing / landing / showcase, also read [`rules/design.md`](./rules/design.md) first (section recipes, spacing rhythm, anti-patterns); for any other rich UI, skim its richness checklist + anti-patterns. Build to the user's brand and request; never clone the Create UI site.
|
|
20
|
+
|
|
21
|
+
## Component inventory
|
|
22
|
+
|
|
23
|
+
Every item below ships in `@createui` - and nothing else does. There is **no card, table, tabs, sheet, drawer, skeleton, sidebar, dialog/modal, popover, or alert-banner component**; the only modal surface is `CommandDialog` (part of `command`). Build other layouts from semantic-token markup and these primitives - don't invent lookalikes.
|
|
24
|
+
|
|
25
|
+
<!-- MAINTENANCE: if modal/popover/alert-banner ever get registered in ui/_registry.ts, update the sentence above and the matching negations in rules/composition.md and the notes files - the generator does not maintain hand-written prose. -->
|
|
26
|
+
|
|
27
|
+
<!-- BEGIN GENERATED:INVENTORY -->
|
|
28
|
+
|
|
29
|
+
| Item | Exports | Key props (defaults starred) |
|
|
30
|
+
| --- | --- | --- |
|
|
31
|
+
| accordion | Accordion, AccordionItem, AccordionTrigger, AccordionContent | appearance: ghost-default*\|ghost-underline\|ghost-rounded\|outline-rounded\|outline-sharp\|filled-rounded |
|
|
32
|
+
| app-store-badge | AppStoreBadge | variant: black*\|white · appearance: filled*\|outline · iconOnly · brand (required) |
|
|
33
|
+
| aspect-ratio | AspectRatio | |
|
|
34
|
+
| avatar | Avatar, AvatarImage, AvatarText, AvatarIcon, AvatarRing, AvatarBadge, +8 more | variant: {gradient\|strong\|base\|weak\|alpha}-{inverse\|neutral\|red\|green\|orange\|blue\|sky\|indigo\|fuchsia\|yellow\|stable} (55 values) · size: 2xs\|xs\|sm\|md*\|lg\|xl\|2xl · shape: circle*\|rounded · background · stroke |
|
|
35
|
+
| badge | Badge | variant: primary*\|neutral\|neutral-static\|danger\|success\|warning\|info\|verified\|highlighted\|away\|inverse\|inverse-static · appearance: solid\|outline\|soft*\|ghost · size: xs\|sm*\|md · shape: rounded*\|pill · leadingIcon/trailingIcon · iconOnly · numberOnly · disabled |
|
|
36
|
+
| breadcrumb | Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbSeparator | variant: primary\|neutral · appearance: solid\|outline\|ghost · size: xs\|sm\|md · shape: rounded\|pill · separator: chevron\|slash\|dot |
|
|
37
|
+
| button | Button | variant: primary*\|neutral-solid\|neutral-light\|danger\|success\|inverse-solid\|inverse-light · appearance: solid*\|outline\|ghost\|soft · size: xs\|sm\|md\|lg*\|xl · shape: rounded*\|pill\|square · leadingIcon/trailingIcon · iconOnly · loading |
|
|
38
|
+
| button-group | ButtonGroup, ButtonGroupItem | variant: primary*\|neutral\|soft · size: xs\|sm\|md*\|lg\|xl · shape: rounded*\|pill\|square |
|
|
39
|
+
| checkbox | Checkbox | variant: primary*\|neutral\|inverse\|danger\|success\|info · size: xs\|sm*\|md · shape: rounded*\|pill\|square |
|
|
40
|
+
| checkbox-group | CheckboxGroup | variant: primary*\|danger · size: xs\|sm\|md* · placement: left*\|right |
|
|
41
|
+
| chip | Chip | variant: neutral*\|info\|danger\|success · appearance: outline*\|soft · size: xs\|sm\|md\|lg*\|xl · shape: pill\|rounded* · selected · disabled · dragging · closable |
|
|
42
|
+
| close-button | CloseButton | variant: neutral*\|inverse · appearance: solid\|outline\|ghost*\|soft · size: xs\|sm\|md*\|lg\|xl\|2xl · shape: rounded*\|pill\|square |
|
|
43
|
+
| country-flag | CountryFlag, CurrencyFlag, FlagFallback | code (required) |
|
|
44
|
+
| credit-card-input | CreditCardInput | size: xs\|sm\|md · leadingIcon · invalid · disabled · loading · showLeadingIcon · showBadge · showValidationIcon |
|
|
45
|
+
| date-input | DateInput | size: xs\|sm\|md · leadingIcon · invalid · disabled · loading · showLeadingIcon |
|
|
46
|
+
| dropdown-menu | DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, +2 more | size: xs\|sm*\|md |
|
|
47
|
+
| field | Field, FieldLabel, FieldTitle, FieldContent, FieldDescription, FieldError, +6 more | size: xs\|sm*\|md · orientation: vertical*\|horizontal\|responsive · invalid · disabled · loading |
|
|
48
|
+
| info-tooltip | InfoTooltip, InfoTooltipContent, InfoTooltipProvider, InfoTooltipTrigger | variant: primary\|neutral\|inverse\|danger\|info · size: sm\|md\|lg · side: top\|bottom\|left\|right · align: start\|center\|end · showArrow |
|
|
49
|
+
| inline-alert | InlineAlert, InlineAlertIcon, InlineAlertContent, InlineAlertHeading, InlineAlertTitle, InlineAlertDescription, +2 more | variant: primary*\|neutral\|danger\|success\|warning\|info\|away · appearance: solid\|soft\|outline\|default* · layout: horizontal*\|vertical |
|
|
50
|
+
| input | Input, InputProvider, InputShell | size: xs\|sm*\|md |
|
|
51
|
+
| input-group | InputGroup, InputGroupProvider, InputGroupShell, InputGroupSlot, InputGroupControl, InputGroupTextarea, +9 more | invalid · disabled · loading · multiline |
|
|
52
|
+
| input-otp | InputOTP | variant: outline*\|filled · size: lg*\|md\|sm · shape: rounded*\|pill\|square\|underline · invalid |
|
|
53
|
+
| input-stepper | InputStepper | variant: connected\|separated · size: xs\|sm\|md · value/onValueChange · defaultValue · min · max · step · invalid · disabled |
|
|
54
|
+
| label | Label, LabelBlock, LabelMain, LabelIcon, LabelRequired, LabelOptional, +4 more | size: xs\|sm\|md |
|
|
55
|
+
| pagination | Pagination, PaginationContent, PaginationLink, PaginationFirst, PaginationPrevious, PaginationNext, +2 more | variant: compact\|compact-grouped* · shape: rounded*\|pill |
|
|
56
|
+
| phone-input | PhoneInput | size: xs\|sm\|md · invalid · disabled · loading · showHelperIcon |
|
|
57
|
+
| progress | Progress | variant: primary*\|info\|success\|warning\|danger\|away\|neutral\|neutral-static\|neutral-soft\|inverse\|inverse-static\|inverse-soft · appearance: solid*\|gradient · size: xs\|sm\|md*\|lg · shape: sharp\|pill* · type: line*\|circle · value · max · duration |
|
|
58
|
+
| radio | Radio | variant: primary*\|neutral\|danger\|success\|inverse · size: xs\|sm\|md* |
|
|
59
|
+
| radio-group | RadioGroup | variant: primary*\|neutral\|danger · size: xs\|sm\|md* · placement: left*\|right · disabled · invalid |
|
|
60
|
+
| scroll-area | ScrollArea, ScrollBar | appearance: filled*\|ghost · size: sm\|md*\|lg · orientation: vertical*\|horizontal\|both · fade |
|
|
61
|
+
| segmented-control | SegmentedControl, SegmentedControlItem | variant: primary*\|neutral · appearance: flat*\|grouped · size: xs\|sm\|md*\|lg\|xl · shape: rounded*\|pill · value/onValueChange |
|
|
62
|
+
| select | Select, SelectProvider, SelectShell, SelectContent, SelectGroup, SelectItem, +4 more | variant: default*\|compact · size: xs\|sm\|md · loading · invalid |
|
|
63
|
+
| separator | Separator | align: start\|center*\|end |
|
|
64
|
+
| social-login-button | SocialLoginButton | appearance: colorful\|black\|white · size: lg*\|md · shape: rounded*\|pill\|square · iconOnly · brand (required) · config (required) |
|
|
65
|
+
| spinner | Spinner | variant: primary*\|info\|success\|warning\|danger\|away\|neutral\|neutral-static\|neutral-soft\|inverse\|inverse-static\|inverse-soft · appearance: solid\|gradient* · size: xs\|sm*\|md\|lg · cap: sharp\|rounded* · line: short\|long* · animation: spin\|pulse*\|tick |
|
|
66
|
+
| status-badge | StatusBadge | variant: primary*\|danger\|success\|warning\|info\|highlighted\|away\|verified\|cyan\|lime\|neutral\|white · size: xs\|sm\|md* |
|
|
67
|
+
| switch | Switch | variant: primary*\|info\|neutral\|inverse\|semantic · size: md*\|sm\|xs · shape: pill*\|rounded · thumbType: short*\|long · ioTrigger · thumbIcon |
|
|
68
|
+
| switch-group | SwitchGroup | size: xs\|sm\|md* · ioTrigger · placement: left*\|right |
|
|
69
|
+
| tab-menu | TabMenu, TabMenuItem | variant: vertical-button*\|vertical-line\|horizontal-line\|horizontal-button · size: sm\|md*\|lg · value/onValueChange · indicator: left\|top\|bottom |
|
|
70
|
+
| text-link | TextLink | variant: primary*\|neutral\|inverse\|danger\|success\|info · size: xs\|sm\|md*\|lg · leadingIcon/trailingIcon · visited · disabled · underline |
|
|
71
|
+
| textarea | Textarea | size: xs\|sm*\|md · resizable: x\|y\|both · loading |
|
|
72
|
+
| toast | Toast, ToastBody, ToastIcon, ToastContent, ToastTitle, ToastDescription, +3 more | variant: primary*\|neutral\|danger\|success\|warning\|info\|away · appearance: solid*\|soft\|outline\|default |
|
|
73
|
+
| tooltip | Tooltip, TooltipContent, TooltipProvider, TooltipTrigger | TooltipContent: variant: primary*\|neutral\|inverse\|danger\|info · showArrow · side: top\|bottom*\|left\|right · sideOffset |
|
|
74
|
+
|
|
75
|
+
<!-- END GENERATED:INVENTORY -->
|
|
76
|
+
|
|
77
|
+
> The registry also ships **hooks** (`use-mobile`, `use-credit-card-input`, `use-date-input`, `use-phone-input`) and **lib utilities** (`utils`, `country-flags`, `currency-flags`) - installed automatically as dependencies of the components that need them.
|
|
78
|
+
|
|
79
|
+
## Icons
|
|
80
|
+
|
|
81
|
+
**Icons go through props, never as children next to text.** The component sizes the icon per its `size` - never add `size-4` / `w-4 h-4` to an icon inside a component. Import UI icons from `@create-ui/assets/icons` (Remix `Ri*`, e.g. `RiSearchLine`) - **never `lucide-react`**. Brand / flag / payment / social marks come from `@create-ui/assets/{social,flags,payments,brands,badges,banks,crypto}`.
|
|
11
82
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
This skill is for **using Create UI in your app**: install components with the CLI, then compose them with the patterns and rules below.
|
|
17
|
-
|
|
18
|
-
## Current Project Context
|
|
19
|
-
|
|
20
|
-
Run the `info` command to read the project's config and installed components:
|
|
83
|
+
```tsx
|
|
84
|
+
// Correct - icon props
|
|
85
|
+
<Badge variant="success" leadingIcon={<RiCheckLine />}>Verified</Badge>
|
|
86
|
+
<Button appearance="outline" trailingIcon={<RiArrowRightLine />}>Docs</Button>
|
|
21
87
|
|
|
22
|
-
|
|
23
|
-
|
|
88
|
+
// Incorrect - NEVER put the icon in children next to text
|
|
89
|
+
<Badge variant="success"><RiCheckLine /> Verified</Badge>
|
|
24
90
|
```
|
|
25
91
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
-
|
|
53
|
-
- **`
|
|
54
|
-
- **
|
|
55
|
-
- **`
|
|
56
|
-
- **
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
- **
|
|
61
|
-
- **
|
|
62
|
-
- **`
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
- **
|
|
72
|
-
- **
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
92
|
+
<!-- BEGIN GENERATED:ICON-MATRIX -->
|
|
93
|
+
|
|
94
|
+
| Component | leadingIcon | trailingIcon | iconOnly |
|
|
95
|
+
| --- | --- | --- | --- |
|
|
96
|
+
| AppStoreBadge | - | - | yes |
|
|
97
|
+
| Badge | yes | yes | yes |
|
|
98
|
+
| BreadcrumbItem | yes | yes | - |
|
|
99
|
+
| Button | yes | yes | yes |
|
|
100
|
+
| ButtonGroupItem | yes | yes | yes |
|
|
101
|
+
| CreditCardInput | yes | - | - |
|
|
102
|
+
| DateInput | yes | - | - |
|
|
103
|
+
| SegmentedControlItem | yes | yes | yes |
|
|
104
|
+
| SocialLoginButton | - | - | yes |
|
|
105
|
+
| TabMenuItem | yes | yes | - |
|
|
106
|
+
| TextLink | yes | yes | - |
|
|
107
|
+
|
|
108
|
+
Components NOT in this table take no leadingIcon/trailingIcon props:
|
|
109
|
+
|
|
110
|
+
- `Chip` takes its icon or `Avatar` as the FIRST CHILD (auto-slotted into the lead slot). No icon props.
|
|
111
|
+
- `InlineAlert` and `Toast` use dedicated icon subcomponents (`InlineAlertIcon`, `ToastIcon`); `FieldHelper` and `AccordionTrigger` take an `icon` prop; `InputGroupKbd` inherits Badge's icon props.
|
|
112
|
+
- Everything else: icons are not part of the component's API - put the icon next to it in your own markup.
|
|
113
|
+
|
|
114
|
+
<!-- END GENERATED:ICON-MATRIX -->
|
|
115
|
+
|
|
116
|
+
## Cross-cutting invariants
|
|
117
|
+
|
|
118
|
+
- **Prop taxonomy**: `variant` = color intent (`primary`, `danger`, `success`, `neutral-*`, ...) · `appearance` = fill weight (`solid` / `outline` / `soft` / `ghost`) · `size` · `shape`. **There is no `variant="outline"`, `variant="secondary"`, or `variant="destructive"`** - an outline style is `appearance="outline"`, a destructive action is `variant="danger"`.
|
|
119
|
+
- **`Field` owns size; children inherit it.** Set `size` (`xs` | `sm` | `md`) once on `Field`; `Input`, `Select`, `Textarea`, labels and helpers read it via context. Never re-set or downgrade size on a child.
|
|
120
|
+
- **Validation**: `data-invalid` on `Field`, `aria-invalid` on the control. Disabled: `data-disabled` on `Field`, `disabled` on the control.
|
|
121
|
+
- **`Button` has a real `loading` prop** - `<Button loading>Saving...</Button>`. Don't compose spinners into buttons.
|
|
122
|
+
- **Use `asChild` for custom triggers/links** - `<Button asChild><Link href="/x">Docs</Link></Button>`.
|
|
123
|
+
- **Items live inside their Group**: `SelectItem` → `SelectGroup` and `CommandItem` → `CommandGroup` are structural (always wrap); `DropdownMenuGroup` is semantic grouping - a lone `DropdownMenuItem` may sit directly in `DropdownMenuContent`.
|
|
124
|
+
- **Semantic tokens only, never raw colors.** Surfaces `bg-static` / `bg-weak` / `bg-light`, text `text-strongest` / `text-body` / `text-placeholder` / `text-disabled` / `text-static`, borders `border-weak` / `border-light`, primary `bg-primary-base` / `text-primary-base` / `bg-primary-weakest`, status `{error,success,warning,info,away,verified,highlighted}-{base,weak,weakest}`. Never `bg-blue-500`, never hex.
|
|
125
|
+
- **The theme is already chosen - never ask for or re-pick the brand color.** The project's primary and neutral colors were selected at `init` (primary: `indigo`* / `blue` / `lime` / `green` / `red` / `orange` / `yellow` / `cyan`; neutral: `gray`* / `slate` / `zinc` / `base` / `stone`) and live as tokens in the global CSS. Use `bg-primary-base` / `text-primary-base` / `border-primary-*` for any accent - they already render that choice. Do NOT ask the user "what color/theme", do NOT offer or invent a color (there is no `violet` etc. - the set above is fixed), and do NOT rewrite the theme token values in the CSS to "apply" a color. Switching the whole project's theme is `npx @create-ui/cli init --theme <name>` / `--neutral <name>` - only when the user explicitly asks for it.
|
|
126
|
+
- **Focus is `outline-*`, never `ring-*`.**
|
|
127
|
+
- **Spacing**: vertical stacks are `flex flex-col gap-*` (never `space-y-*`); `size-10` not `w-10 h-10`; semantic spacing classes (`gap-component-sm`) only when a Figma design references a token - otherwise standard Tailwind (`gap-4`).
|
|
128
|
+
- **`className` is for layout, not restyling** - don't override a component's colors or typography; reach for `variant`/`appearance` first.
|
|
129
|
+
|
|
130
|
+
## Use the full component API
|
|
131
|
+
|
|
132
|
+
Every component exposes many axes - `variant`, `appearance`, `size`, `shape`, state flags, often `orientation` / `layout` / `placement`, and more - and the set differs per component. **Defaults are a baseline, not the answer**; one size and one variant everywhere reads as a wireframe. Before building with a component, read its `reference/<component>.md` prop table and deliberately use the axes that fit the design. The heuristics below show the *kind* of judgment, not a closed list - `shape` and any component-specific axis count just as much:
|
|
133
|
+
|
|
134
|
+
- **`size`** tracks density / prominence: small for dense or secondary chrome, the default for standard body UI, large for the primary CTA or hero.
|
|
135
|
+
- **`appearance`** tracks hierarchy: exactly one `solid` (primary) action per group, secondary `soft` / `outline`, tertiary or dismiss `ghost`.
|
|
136
|
+
- **`variant`** tracks intent: `primary` for the main action, `neutral-*` for neutral chrome, semantic (`danger` / `success` / `warning` / `info`) only for real meaning - status on Badge / InlineAlert / Toast rides `variant`, never raw color.
|
|
137
|
+
- **State is a prop, not markup**: reach for built-in `loading` / `invalid` (+ `aria-invalid`) / `disabled` / `selected` / `checked` / `readOnly` when context implies them.
|
|
138
|
+
- **Everything else is a real choice too** - `shape`, `orientation` / `layout` (e.g. `Field orientation="horizontal"`, `InlineAlert layout="vertical"`, `TabMenu variant="horizontal-line"` vs `"vertical-button"`), `placement`, and whatever else the component's reference lists. Match it to the design; don't leave it at default out of habit.
|
|
139
|
+
|
|
140
|
+
Each `reference/<component>.md` canonical example already spans its component's axes - mirror that range, don't collapse to defaults. `rules/design.md` has the per-component richness checklist and anti-patterns.
|
|
141
|
+
|
|
142
|
+
## Never hand-roll
|
|
143
|
+
|
|
144
|
+
| You need | Use (never raw markup) |
|
|
145
|
+
| --- | --- |
|
|
146
|
+
| Tabs | `TabMenu` + `TabMenuItem` + your own value-keyed panels (recipe below) |
|
|
147
|
+
| Toggle between 2-7 options | `SegmentedControl` + `SegmentedControlItem` (`value`/`onValueChange`) - never a row of `Button`s with manual active state |
|
|
148
|
+
| Tag / label | `Badge` (icons via `leadingIcon`/`trailingIcon`) |
|
|
149
|
+
| Removable / interactive tag | `Chip` (icon or `Avatar` as FIRST CHILD, `closable`/`onClose`) |
|
|
150
|
+
| Status dot | `StatusBadge` (dot only - label goes next to it) |
|
|
151
|
+
| Callout / inline banner | `InlineAlert` (+`InlineAlertIcon`/`Title`/`Description`) |
|
|
152
|
+
| Notification | `Toast` (+`ToastIcon`/`ToastTitle`/`ToastAction`) |
|
|
153
|
+
| Avatar initials | `Avatar` + `AvatarText` (**`AvatarFallback` does not exist**) |
|
|
154
|
+
| Loading state | `Spinner`, or `Button loading` |
|
|
155
|
+
| Divider | `Separator` |
|
|
156
|
+
| Menu | `DropdownMenu` family |
|
|
157
|
+
| Command palette | `Command` (inline) / `CommandDialog` (modal) |
|
|
158
|
+
|
|
159
|
+
## Recipes
|
|
160
|
+
|
|
161
|
+
**Tabs with content panels** - `TabMenu` renders the tab list only; you render the panels, keyed by value:
|
|
77
162
|
|
|
78
163
|
```tsx
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
<Button loading>Saving…</Button>
|
|
88
|
-
<Button asChild appearance="ghost" trailingIcon={<RiArrowRightLine />}>
|
|
89
|
-
<Link href="/docs">Docs</Link>
|
|
90
|
-
</Button>
|
|
91
|
-
|
|
92
|
-
// Forms: FieldGroup + Field. Field owns size; Input inherits it.
|
|
93
|
-
<FieldGroup>
|
|
94
|
-
<Field size="md">
|
|
95
|
-
<FieldLabel htmlFor="email">Email</FieldLabel>
|
|
96
|
-
<Input id="email" type="email" />
|
|
97
|
-
<FieldDescription>We'll never share it.</FieldDescription>
|
|
98
|
-
</Field>
|
|
99
|
-
</FieldGroup>
|
|
100
|
-
|
|
101
|
-
// Spacing: gap-component-sm only when Figma uses a token; otherwise gap-4.
|
|
102
|
-
<div className="flex flex-col gap-4">…</div>
|
|
103
|
-
|
|
104
|
-
// Conditional classes via cn().
|
|
105
|
-
<div className={cn("rounded-lg p-4", isActive && "bg-weak")} />
|
|
164
|
+
const [tab, setTab] = React.useState("overview")
|
|
165
|
+
|
|
166
|
+
<TabMenu variant="horizontal-line" indicator="bottom" value={tab} onValueChange={setTab}>
|
|
167
|
+
<TabMenuItem value="overview" label="Overview" />
|
|
168
|
+
<TabMenuItem value="billing" label="Billing" leadingIcon={<RiBankCardLine />} />
|
|
169
|
+
</TabMenu>
|
|
170
|
+
{tab === "overview" && <OverviewPanel />}
|
|
171
|
+
{tab === "billing" && <BillingPanel />}
|
|
106
172
|
```
|
|
107
173
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
Every name below ships in `@createui` — and nothing else does. If a component isn't in this table (there is no card, table, tabs, sheet, drawer, skeleton, sidebar, dialog/modal, popover, or alert-banner component), build the layout from semantic-token markup and these primitives instead. The only modal surface is `CommandDialog` (part of `command`).
|
|
111
|
-
|
|
112
|
-
| Need | Use |
|
|
113
|
-
| -------------------------- | ------------------------------------------------------------------------------------------------------ |
|
|
114
|
-
| Button / action | `Button` (`variant` + `appearance`), `ButtonGroup`, `CloseButton`, `SocialLoginButton`, `AppStoreBadge` |
|
|
115
|
-
| Form layout | `Field` + `FieldGroup` (+ `FieldSet` / `FieldLegend`), `Label` |
|
|
116
|
-
| Form inputs | `Input`, `Textarea`, `Select`, `Checkbox`, `Radio` / `RadioGroup`, `Switch`, `InputOTP` |
|
|
117
|
-
| Grouped on/off controls | `CheckboxGroup`, `SwitchGroup` |
|
|
118
|
-
| Formatted inputs | `DateInput`, `PhoneInput`, `CreditCardInput`, `InputStepper`, `PasswordStrength` |
|
|
119
|
-
| Toggle between 2–7 options | `SegmentedControl` + `SegmentedControlItem` |
|
|
120
|
-
| Inputs with affordances | `InputGroup` + `InputGroupAddon` / `InputGroupButton` |
|
|
121
|
-
| Data display | `Badge`, `StatusBadge` (dot), `Chip`, `Avatar`, `CountryFlag` / `CurrencyFlag` (both from the `country-flag` item), `Progress` |
|
|
122
|
-
| Navigation | `Breadcrumb`, `Pagination`, `TabMenu`, `TextLink` |
|
|
123
|
-
| Menus | `DropdownMenu` |
|
|
124
|
-
| Command palette | `Command` (inline) / `CommandDialog` (modal) |
|
|
125
|
-
| Feedback | `Toast`, `InlineAlert` (inline callout), `Progress`, `Spinner` |
|
|
126
|
-
| Tooltips / info | `Tooltip`, `InfoTooltip` |
|
|
127
|
-
| Layout | `Accordion`, `AspectRatio`, `ScrollArea`, `Separator` |
|
|
128
|
-
|
|
129
|
-
> **Icons & assets** all come from `@create-ui/assets`: UI icons at `@create-ui/assets/icons` (Remix `Ri*`), plus `social` / `flags` / `payments` / `brands` / `badges` / `banks` / `crypto` marks (these back `CountryFlag`, `SocialLoginButton`, …). Never import from `lucide-react`. See [rules/icons.md](./rules/icons.md).
|
|
130
|
-
|
|
131
|
-
> The registry also ships **hooks** (`use-mobile`, `use-credit-card-input`, `use-date-input`, `use-phone-input`) and **lib utilities** (`utils`, `country-flags`, `currency-flags`) — these appear in `search` results as `registry:hook` / `registry:lib` items and are installed automatically as dependencies of the components that need them.
|
|
132
|
-
|
|
133
|
-
## Key Fields (components.json)
|
|
134
|
-
|
|
135
|
-
`info` surfaces these fields — read them before writing imports or advising on directives:
|
|
136
|
-
|
|
137
|
-
- **`aliases`** — the import prefixes (`components`, `utils`, `ui`, `lib`, `hooks`). Use the actual aliases (e.g. `@/components/ui`, `@/lib/utils`), never hardcode.
|
|
138
|
-
- **`rsc`** — when `true`, components using `useState`, `useEffect`, event handlers, or browser APIs need `"use client"` at the top.
|
|
139
|
-
- **`tsx`** — whether components are emitted as `.tsx` (default `true`).
|
|
140
|
-
- **`tailwind.css`** — the global CSS file where tokens are defined. Edit this file; never create a new one.
|
|
141
|
-
- **`iconLibrary`** — Create UI's icon library, `createui`. Icons (and all marks) come from `@create-ui/assets`; UI icons are `@create-ui/assets/icons` (Remix `Ri*`). Never import from `lucide-react` or another package.
|
|
142
|
-
- **`menuColor`** (`default` | `inverted`) / **`menuAccent`** (`subtle` | `bold`) — menu surface treatment.
|
|
174
|
+
**Billing / pricing toggle** - the active pill slides between items in both appearances; `appearance="grouped"` adds the padded `bg-weak` container (the classic pricing-toggle look):
|
|
143
175
|
|
|
144
|
-
|
|
176
|
+
```tsx
|
|
177
|
+
const [billing, setBilling] = React.useState("monthly")
|
|
145
178
|
|
|
146
|
-
|
|
179
|
+
<SegmentedControl appearance="grouped" variant="neutral" value={billing} onValueChange={setBilling}>
|
|
180
|
+
<SegmentedControlItem value="monthly">Monthly</SegmentedControlItem>
|
|
181
|
+
<SegmentedControlItem value="yearly">Yearly</SegmentedControlItem>
|
|
182
|
+
</SegmentedControl>
|
|
183
|
+
```
|
|
147
184
|
|
|
148
|
-
|
|
185
|
+
**Showcase-quality switch** - bare `<Switch />` is for dense forms; showcases should exercise the richer API (see `reference/switch.md`). Labelled apply-immediately rows use `SwitchGroup`; the `Field` composition below is for submit-to-save forms:
|
|
149
186
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
187
|
+
```tsx
|
|
188
|
+
<Field size="md" orientation="horizontal">
|
|
189
|
+
<FieldContent>
|
|
190
|
+
<FieldLabel htmlFor="2fa">Enforce two-factor auth</FieldLabel>
|
|
191
|
+
</FieldContent>
|
|
192
|
+
<Switch id="2fa" thumbIcon defaultChecked />
|
|
193
|
+
</Field>
|
|
194
|
+
<Switch variant="semantic" thumbType="long" ioTrigger aria-label="Accept" />
|
|
195
|
+
```
|
|
157
196
|
|
|
158
|
-
|
|
197
|
+
(`Field` size does not cascade to `Switch` - pair them explicitly, or use `SwitchGroup` which pairs both automatically.)
|
|
159
198
|
|
|
160
|
-
|
|
199
|
+
## components.json keys
|
|
161
200
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
201
|
+
- **`aliases`** - import prefixes (`ui`, `components`, `utils`, `lib`, `hooks`). Use the project's actual aliases, never hardcode.
|
|
202
|
+
- **`rsc`** - when `true`, components using state/effects/events need `"use client"`. Keep the boundary tight: isolate the interactive piece in its own file rather than hoisting the directive over a whole static section.
|
|
203
|
+
- **`tailwind.css`** - the global CSS file where tokens live. Edit it; never create a new one. Never rewrite the primary/neutral theme token values here to change the brand color - that is an `init` choice (see invariants above).
|
|
204
|
+
- **`iconLibrary`** - `createui` (`@create-ui/assets`). Never swap registry imports to another icon package.
|
|
205
|
+
- **`menuColor`** (`default` | `inverted`) / **`menuAccent`** (`subtle` | `bold`) - menu surface treatment.
|
|
166
206
|
|
|
167
|
-
##
|
|
207
|
+
## CLI quick reference
|
|
168
208
|
|
|
169
209
|
```bash
|
|
170
|
-
|
|
171
|
-
npx @create-ui/cli
|
|
172
|
-
npx @create-ui/cli
|
|
173
|
-
|
|
174
|
-
# Scaffold a new project (missing name/template/theme are prompted interactively).
|
|
175
|
-
npx @create-ui/cli create my-app --template next
|
|
176
|
-
npx @create-ui/cli create
|
|
177
|
-
|
|
178
|
-
# Add components (items are always bare names).
|
|
179
|
-
npx @create-ui/cli add button select dropdown-menu
|
|
180
|
-
npx @create-ui/cli add --all
|
|
181
|
-
|
|
182
|
-
# Inspect the registry (@createui is the registry argument for search/list only).
|
|
210
|
+
npx @create-ui/cli init # existing project (writes components.json)
|
|
211
|
+
npx @create-ui/cli create my-app --template next # new project (next | start | vite)
|
|
212
|
+
npx @create-ui/cli add button select # add components (bare names)
|
|
183
213
|
npx @create-ui/cli search @createui -q "toast"
|
|
184
|
-
npx @create-ui/cli
|
|
185
|
-
npx @create-ui/cli
|
|
186
|
-
npx @create-ui/cli
|
|
187
|
-
|
|
188
|
-
# Migrate (e.g. consolidate radix imports, or switch icon library).
|
|
189
|
-
npx @create-ui/cli migrate --list
|
|
190
|
-
|
|
191
|
-
# Set up the MCP server for your client.
|
|
192
|
-
npx @create-ui/cli mcp init --client claude
|
|
214
|
+
npx @create-ui/cli view button # item metadata + files
|
|
215
|
+
npx @create-ui/cli diff button # upstream changes for installed items
|
|
216
|
+
npx @create-ui/cli mcp init --client claude # set up the MCP server
|
|
193
217
|
```
|
|
194
218
|
|
|
195
|
-
|
|
196
|
-
**Neutral themes:** gray (default), slate, zinc, base, stone
|
|
197
|
-
**Templates:** `next`, `start`, `vite` (plus `next-monorepo` for `init`)
|
|
219
|
+
`add --overwrite` replaces files - only with the user's explicit approval. To update, prefer `diff` and merge upstream changes while preserving local edits. Primary themes: indigo (default), blue, lime, green, red, orange, yellow, cyan. Neutrals: gray (default), slate, zinc, base, stone.
|
|
198
220
|
|
|
199
|
-
## Detailed
|
|
221
|
+
## Detailed references
|
|
200
222
|
|
|
201
|
-
- [
|
|
202
|
-
- [
|
|
203
|
-
- [
|
|
204
|
-
- [rules/
|
|
205
|
-
- [rules/forms.md](./rules/forms.md)
|
|
206
|
-
- [rules/
|
|
207
|
-
- [
|
|
223
|
+
- [reference/](./reference/) - **per-component API (generated from source - read before first use)**.
|
|
224
|
+
- [rules/design.md](./rules/design.md) - design taste: hero/CTA/footer/pricing recipes, richness checklist, anti-patterns.
|
|
225
|
+
- [rules/icons.md](./rules/icons.md) - icon props per component, sizing, assets packages.
|
|
226
|
+
- [rules/composition.md](./rules/composition.md) - groups, overlays, TabMenu, Avatar, InlineAlert, Toast.
|
|
227
|
+
- [rules/forms.md](./rules/forms.md) - FieldGroup/Field, size cascade, InputGroup, SegmentedControl, validation.
|
|
228
|
+
- [rules/styling.md](./rules/styling.md) - semantic tokens, className scope, spacing, focus.
|
|
229
|
+
- [cli.md](./cli.md) - every command and flag. [mcp.md](./mcp.md) - MCP tools and workflow. [customization.md](./customization.md) - theming and tokens.
|
|
208
230
|
|
|
209
231
|
## Resources
|
|
210
232
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
interface:
|
|
2
2
|
display_name: "Create UI"
|
|
3
|
-
short_description: "
|
|
3
|
+
short_description: "Create UI component library: per-component API references, composition rules, semantic tokens, and design recipes for building UI with the @createui registry."
|
|
4
4
|
icon_small: "./assets/createui-small.png"
|
|
5
5
|
icon_large: "./assets/createui.png"
|