Button
stableA clickable control with six variants and four sizes, complete with spring-press feedback.
Basic usage
Examples
Sizes
Four sizes — sm, default, lg, and icon — plus a disabled state.
Variants and sizes
Preview the common visual variants, icon affordance and disabled state together.
Color palette
Use the color prop with contained, outlined, and text variants for semantic intent.
Features
- Six visual variants and four sizes.
- Spring-eased press animation on tap.
- Supports `asChild` to render any element.
- Full keyboard and screen-reader support.
Installation
bash
pnpm dlx structyl add buttonAPI Reference
Button
The button element.
| Prop | Type | Default |
|---|---|---|
| variant | 'default' | 'secondary' | 'outline' | 'ghost' | 'link' | 'destructive'Visual style. | 'default' |
| size | 'default' | 'sm' | 'lg' | 'icon'Control size. | 'default' |
| asChild | booleanMerge props onto the child element instead of rendering a button. | false |
| disabled | booleanDisable the button. | false |
Keyboard interactions
| Key | Description |
|---|---|
| Space | Activates the button. |
| Enter | Activates the button. |