Container
RequiredNative action target carrying variant, size, and interaction styles.
buttonActions & feedback
The primary action primitive, with explicit hierarchy, size, and semantic-button behavior.
ButtonbuttonStylesButtonPropsButtonSizeButtonVariantConfigure the production component, inspect it at responsive widths, copy synchronized JSX, and share the exact state from one workspace.
This JSX stays synchronized with the controls and uses only public package APIs.
import { Save } from 'lucide-react';
import { Button } from '@ai-created/ui';
export function Example() {
return (
<Button>
<Save className="h-4 w-4" aria-hidden="true" />
{"Save changes"}
</Button>
);
}
import { Button, buttonStyles } from '@ai-created/ui';Client boundary
'use client' to the file that owns this interactive state.Replace the version placeholder with the release tag your product has reviewed.
npm install --install-links "git+https://github.com/TheMarco/ai-created-ui.git#vX.Y.Z"@import '@ai-created/ui/styles/tokens.css';
@tailwind base;
@tailwind components;
@tailwind utilities;module.exports = {
presets: [require('@ai-created/ui/tailwind-preset')],
content: [
'./src/**/*.{js,ts,jsx,tsx,mdx}',
'./node_modules/@ai-created/ui/src/**/*.{js,ts,jsx,tsx}',
],
};Named regions define what belongs to the component, what remains optional, and where semantic responsibility lives.
Native action target carrying variant, size, and interaction styles.
buttonOptional decorative icon placed before the label.
Short verb phrase describing the result of activation.
Optional icon communicating direction or external behavior.
The Figma-equivalent asset model, auto-layout, resizing, properties, slots, content bounds, localization, and governance contract.
Asset kind
component
Design library name
Components/Actions/Button
Maturity
stable
Last reviewed
2026-08-29
Canvas applicability
Publish one public component set with Variant, Size, and State controls and editable label/icon properties. Preserve all 168 supported combinations so designers can change visual treatment without replacing an instance. Theme, accent, and icon rendering use shared variable modes.
| Property | Type | Default | Code mapping | Options or notes |
|---|---|---|---|---|
| Variant | variant | primary | variant | primary, secondary, destructive, ghost, filter, filter-active, icon |
| Size | variant | md | size | inline, sm, md, lg, xl, icon |
| State | variant | default | Interaction preview; disabled maps to the native disabled prop | default, hover, focus-visible, disabled |
| LabelRequired | text | Save changes | children | No additional constraint |
| Show leading icon | boolean | false | Presence of an optional leading icon child | No additional constraint |
| Show trailing icon | boolean | false | Presence of an optional trailing icon child | No additional constraint |
| Leading icon | instance-swap | None | First child, decorative unless it supplies the icon-only accessible name | No additional constraint |
| Trailing icon | instance-swap | None | Last child, mark decorative | No additional constraint |
Single-line action label.
childrenOptional 16px icon before the label.
childrenOptional 16px icon after the label.
childrenOverflow: Never truncate; revise the label or allow the parent to allocate more width.
Action labels must remain immediately scannable.
Overflow: Remove redundant icons.
Multiple symbols compete with the action label.
Translatable: Label, Accessible name
Intrinsic sizing with a parent-controlled full-width option.
No internal breakpoint
Accountable owner
Design systems action primitive owner
Canonical source: src/components/Button.tsx
These measurements and semantic tokens define the supported visual contract. Local overrides should preserve the same hierarchy and interaction cues.
Corner radius
6px
Uses radius-md.
Content gap
10px
Horizontal padding
20 / 25 / 30 / 40px
sm / md / lg / xl.
Vertical padding
10 / 10 / 15 / 15px
sm / md / lg / xl.
Text button height
Content-derived: inline 27px, sm/md 47px, lg/xl 57px including the shared 1px border
Measurements use the 20px root; identical content and size have identical outer dimensions across every variant.
Icon-only target
55 × 55px
--color-action-primary / --color-action-primary-hoverPrimary action background and hover.
--color-action-destructive / --color-action-destructive-hoverDestructive action background and hover.
--color-on-actionForeground on filled actions.
--color-control-border / --color-control-border-strongSecondary, filter, and icon control boundaries.
--color-focusGlobal focus-visible outline.
--motion-fastColor transition duration.
--radius-mdContainer radius.
A component is not complete until its passive, interactive, disabled, and exceptional states remain understandable in both themes.
Semantics, accessible naming, keyboard behavior, focus and announcements are implementation requirements, not optional documentation.
Use the public package API and preserve the controlled-state, native-attribute, and ref contracts described below.
import { Button, buttonStyles } from '@ai-created/ui';Client Component required
<Button variant="primary">Save changes</Button>Use a native submit type inside a form.
<Button type="submit">Save changes</Button>These props and helpers are compatibility contracts. Changes require migration guidance and release notes.
| Prop | Type | Default | Contract |
|---|---|---|---|
| variant | ButtonVariant | primary | primary, secondary, destructive, ghost, filter, filter-active, or icon. |
| size | ButtonSize | md | inline, sm, md, lg, xl, or icon. |
| fullWidth | boolean | false | Expands the button to the available width. |
| type | button | submit | reset | button | Native button type. |
| className | string | undefined | Additional classes. |
These rules keep the component recognizable across products without preventing deliberate composition.
The component should be verified as rendered UI, an interaction model, an accessibility surface, and a theme-aware visual artifact.