# @ai-created/ui complete agent reference This file is generated. Do not edit it directly. Canonical sources are listed below, and the machine-readable equivalent is `design-system.manifest.json`. ## Source precedence 1. **runtime behavior and public API** (`src/**`, `src/index.ts`): Production source is canonical for semantics, props, and behavior. 2. **design tokens** (`styles/tokens.css`): Token CSS is canonical. JSON and framework mappings are derived views. 3. **framework mappings** (`tailwind-preset.js`): The preset maps canonical semantic CSS variables into utilities. 4. **component and construction guidance** (`playground/src/components/design-system/componentDocs.ts`, `playground/src/components/design-system/specs/details.ts`, `playground/src/components/design-system/specs/construction.ts`, `playground/src/components/design-system/specs/registry.ts`): The merged registry is canonical for supported design and authoring guidance. 5. **system guidelines** (`playground/src/components/design-system/principal-spec/registry.ts`): The principal guideline registry is canonical for cross-component practice. 6. **narrative documentation** (`AGENTS.md`, `DESIGN-SYSTEM.md`, `README.md`, `CLAUDE.md`): Narrative documentation explains canonical sources and must not override them. ## Non-negotiable build rules - Use public imports from `@ai-created/ui` only. - Import `@ai-created/ui/styles/tokens.css` once and load `@ai-created/ui/tailwind-preset`. - Use semantic token names and approved component variants. Do not invent raw colors, fonts, radii, shadows, primitive copies, or internal imports. - Compose existing primitives before adding a local abstraction. - Use native semantics and each component's documented keyboard and accessibility contract. - Preserve DOM order across responsive layouts. - Implement all applicable exceptional states. - Treat `className` as a composition hook, not a second visual language. - Run `npm run agent:check` before handoff. ## Downstream consumer lifecycle 1. Install an immutable `vX.Y.Z` tag. Existing sites remain on that release until their owner deliberately adopts another one; consumers never follow `main`. 2. Opt into update discovery with Renovate. Merge the documented `@ai-created/ui` package rule into the consumer's own Renovate configuration; no central registration is required. 3. Renovate detects a newer GitHub tag and opens a pull request that updates both `package.json` and `package-lock.json`. The consumer owns any optional schedule and Dependency Dashboard settings. 4. Run the consumer's own install, typecheck, lint, tests, design-policy validation, accessibility checks, and production build. Provider previews may help review but do not replace those compatibility checks. 5. Review release notes and visible or behavioral impact, then merge manually. Design-system dependency updates do not auto-merge. 6. Verify the consumer's normal deployment completed and smoke-test the affected workflow. 7. Optionally run `npx ai-created-ui-agent consumer-status` on a schedule to make staleness visible. This command reports status; it does not update, merge, or deploy the consumer. Use `docs/consumer-update-automation.md` for setup, configuration, review, troubleshooting, and removal. Use `docs/examples/consumer-renovate.json` as a standalone example or copy only its package rule into an existing Renovate configuration. # Components ## Button / buttonStyles (`button`) The primary action primitive, with explicit hierarchy, size, and semantic-button behavior. - Category: Actions & feedback - Source: `src/components/Button.tsx` - Public exports: `Button`, `buttonStyles`, `ButtonProps`, `ButtonSize`, `ButtonVariant` - Import: `import { Button, buttonStyles } from '@ai-created/ui';` - Client component: yes - Design asset: Components/Actions/Button - Maturity: stable - Owner: Design systems action primitive owner ### Use when - Submitting or confirming an action - Providing a compact inline or icon action ### Avoid when - Navigation that should be a link - Non-interactive status text ### Public API - `variant`: `ButtonVariant`. Default: primary. primary, secondary, destructive, ghost, filter, filter-active, or icon. - `size`: `ButtonSize`. Default: md. inline, sm, md, lg, xl, or icon. - `fullWidth`: `boolean`. Default: false. Expands the button to the available width. - `type`: `button | submit | reset`. Default: button. Native button type. - `className`: `string`. Default: undefined. Additional classes. ### States - default: Idle and enabled. Activates on click, Enter, or Space. - hover: Pointer rests over an enabled button. No action until activation. - focus-visible: Keyboard focus enters the button. Remains the current tab stop. - disabled: disabled is true. Native activation and focus are suppressed. ### Keyboard - Enter: Activates the button. - Space: Activates the button. - Tab / Shift+Tab: Moves focus to or from an enabled button. ### Accessibility - Semantics: Native ``` ### Content and authoring limits - Label: One line, recommended 2 to 24 characters, maximum 32. Never truncate; revise the label or allow the parent to allocate more width. - Icons: At most one icon on either side. Remove redundant icons. - Design-tool limit: Figma interactive variants may demonstrate hover and press but cannot reproduce native button semantics. - Design-tool limit: Do not detach instances to make one-off sizes. - Code limit: Icon-only use requires an accessible name that is not represented by visual geometry. - Code limit: buttonStyles can style another element but does not supply button behavior. ### Required tests - Unit: Defaults to primary, md, and type button. - Unit: Forwards ref, className, disabled, and native attributes. - Interaction: Activates by pointer, Enter, and Space; disabled buttons do not activate. - Accessibility: Has an accessible name and no axe violations in every variant. - Visual: Snapshot every variant, size, disabled state, focus-visible state, and both themes. ## Badge (`badge`) A compact, non-interactive label for status, category, or short metadata. - Category: Actions & feedback - Source: `src/components/Badge.tsx` - Public exports: `Badge`, `BadgeProps`, `BadgeVariant` - Import: `import { Badge } from '@ai-created/ui';` - Client component: no - Design asset: Components/Feedback/Badge - Maturity: stable - Owner: Design systems feedback owner ### Use when - Showing compact metadata or status ### Avoid when - Long messages - Interactive controls ### Public API - `variant`: `BadgeVariant`. Default: default. default, muted, success, warning, error, or info. - `className`: `string`. Default: undefined. Additional classes. - `...props`: `HTMLAttributes`. Default: undefined. Native span attributes. ### States - default: Default variant. Static metadata. - muted: Muted variant. Static metadata. - success: Positive status. Static metadata. - warning: Cautionary status. Static metadata. - error: Failure status. Static metadata. - info: Informational status. Static metadata. ### Keyboard - None documented. ### Accessibility - Semantics: Plain inline with no implicit role. - Accessible name: Text content is read in surrounding context. - Write a meaningful label rather than encoding meaning only by color. - Do not add interaction to Badge; pair it with a real control when needed. ### Tokens - --color-surface / --color-surface2: Neutral fills. - --color-border: Neutral border. - --color-success / warning / info / error: Semantic text. - --color-*-surface / --color-*-border: Semantic fill and border pairs. ### Composition - Place beside a title, table value, or list item. ### Implementation notes - Forwards a span ref and accepts native span attributes. - Use variant for semantic tone and className only for contextual layout. ### Recipes - None documented. ### Content and authoring limits - Label: One to three words, maximum 24 characters. Do not truncate; replace with shorter vocabulary. - Design-tool limit: Do not add interactive variants to the design asset. - Code limit: Badge remains a span and must not receive click behavior. ### Required tests - Unit: Renders a span and maps all six variants. - Unit: Forwards ref and native attributes. - Interaction: No interaction is expected. - Accessibility: Text remains meaningful without color. - Visual: Capture every tone in dark and light modes. ## Surface / surfaceStyles (`surface`) A themed structural container that groups related content without imposing semantics. - Category: Layout & content - Source: `src/components/Surface.tsx` - Public exports: `Surface`, `surfaceStyles`, `SurfaceProps`, `SurfaceVariant`, `SurfacePadding`, `SurfaceInteraction` - Import: `import { Surface, surfaceStyles } from '@ai-created/ui';` - Client component: no - Design asset: Components/Layout/Surface - Maturity: stable - Owner: Design systems layout primitive owner ### Use when - Grouping related content - Creating cards or inset sections ### Avoid when - A plain layout wrapper is sufficient ### Public API - `variant`: `SurfaceVariant`. Default: default. default, muted, accent, inset, success, warning, info, or error. - `padding`: `SurfacePadding`. Default: none. none, sm, md, lg, xl, or responsive. - `interaction`: `SurfaceInteraction`. Default: none. none, group, or within interaction styling. - `className`: `string`. Default: undefined. Additional classes. ### States - default: No interaction. Pure layout container. - interactive group: A parent group is hovered or focus-visible. Feedback follows the parent control. - interactive within: The surface is hovered or contains focus. Does not become keyboard interactive by itself. ### Keyboard - None documented. ### Accessibility - Semantics: Default element is a non-semantic
. surfaceStyles can style another semantic root. - Accessible name: The surface has no name by default. - Add a heading, region label, list semantics, or interactive wrapper when content needs structure. - Never imply clickability through interaction styling without a keyboard-operable element. ### Tokens - --color-surface / --color-surface2 / --color-bg: Structural backgrounds. - --color-border / --color-border-strong: Default border and interaction emphasis. - --color-accent-border: Accent border. - --color-*-surface / --color-*-border: Semantic variants. - --radius-md: Corner radius. ### Composition - Use as the visual root of EmptyState and Notice. - surfaceStyles supports custom semantic elements. ### Implementation notes - Surface forwards a div ref and native HTML attributes. - Use surfaceStyles to apply the same visual contract to a semantic article, section, or link. ### Recipes - None documented. ### Content and authoring limits - Nested surfaces: Maximum one bordered child layer in ordinary product UI. Flatten excess wrappers or remove an inner border. - Design-tool limit: Interaction variants are visual demonstrations and do not make the Figma layer operable. - Code limit: Surface has no semantics or interaction by itself; use a semantic wrapper when needed. ### Required tests - Unit: Maps every variant, padding, and interaction value. - Unit: Consumer className overrides default utilities. - Interaction: Group and focus-within borders respond to their documented triggers. - Accessibility: Semantic wrappers retain their roles and names. - Visual: Cover all variants plus interaction borders in both themes. ## Notice (`notice`) An inline live-region message for informational, positive, cautionary, or error feedback. - Category: Actions & feedback - Source: `src/components/Notice.tsx` - Public exports: `Notice`, `NoticeProps`, `NoticeVariant` - Import: `import { Notice } from '@ai-created/ui';` - Client component: no - Design asset: Components/Feedback/Notice - Maturity: stable - Owner: Design systems feedback owner ### Use when - Explaining status near the relevant content ### Avoid when - Transient toast notifications - Multi-step forms needing field-level errors ### Public API - `variant`: `NoticeVariant`. Default: default. default, info, success, warning, or error. - `title`: `string`. Default: undefined. Optional notice heading. - `children`: `ReactNode`. Default: undefined. Message content. - `role`: `string`. Default: status or alert. Override the semantic role. - `aria-live`: `polite | assertive | off`. Default: polite or assertive. Override announcement behavior. ### States - default: Neutral message. Polite status announcement. - info: Informational message. Polite status announcement. - success: Successful outcome. Polite status announcement. - warning: Caution or required review. Polite status announcement. - error: Failed outcome. Assertive alert announcement. ### Keyboard - None documented. ### Accessibility - Semantics: role=status by default; error uses role=alert. Both are overridable. - Accessible name: Title and body text form the announcement. - Keep icons decorative. - Avoid inserting a status region before its content is ready if it should be announced as a change. - Use error only for information that merits an assertive interruption. ### Tokens - --color-*-surface: Tone background. - --color-*-border: Tone border. - --color-info / success / warning / error: Title and icon. - --color-text2: Body copy. ### Composition - Use ErrorReport for expandable technical details. ### Implementation notes - The role and aria-live defaults are derived from variant. - centered and hideIcon change presentation only. - Use ErrorReport when technical details need disclosure and copying. ### Recipes - None documented. ### Content and authoring limits - Title: One line, recommended maximum 48 characters. Wrap only when localization requires it. - Body: Two short paragraphs or 240 characters. Move complex guidance into adjacent content. - Design-tool limit: Prototype presentation does not reproduce live-region announcements. - Code limit: Custom role and aria-live values must remain aligned with severity. ### Required tests - Unit: Derives Surface variant, role, and aria-live correctly. - Unit: Honors explicit role and aria-live overrides. - Interaction: A newly rendered error is announced; centered and hidden-icon options preserve content. - Accessibility: Icons are hidden and live-region semantics match severity. - Visual: Capture every tone, title/body combination, centered treatment, and both themes. ## Skeleton (`skeleton`) A decorative loading placeholder that reserves the final content footprint. - Category: Actions & feedback - Source: `src/components/Skeleton.tsx` - Public exports: `Skeleton`, `SkeletonProps` - Import: `import { Skeleton } from '@ai-created/ui';` - Client component: no - Design asset: Components/Feedback/Skeleton - Maturity: stable - Owner: Design systems feedback owner ### Use when - Loading predictable content regions ### Avoid when - Unknown layouts where a spinner is clearer ### Public API - `className`: `string`. Default: undefined. Controls size and shape with utility classes. - `...props`: `HTMLAttributes`. Default: undefined. Native div attributes. ### States - loading: Content is pending. Reserves layout only. ### Keyboard - None documented. ### Accessibility - Semantics: Decorative