Button
Clickable action with variants, sizes, loading state, icon slots, and asChild.
At a glance
- Click target with full keyboard / RN
Pressablesemantics — focus ring on web, press feedback on native. - Forwards every
Pressableprop (onPress,onLongPress,accessibilityLabel, …) untouched. - Use
Togglefor two-state buttons andFloatButtonfor the floating-action-button pattern.
Preview
Native preview (Expo Snack)
variant
Visual emphasis. Pick by hierarchy, not color.
| Value | Use for |
|---|---|
primary (default) | The single most-important action on a screen |
secondary | Equally relevant actions, paired with a primary |
ghost | Tertiary actions in dense layouts (cards, toolbars) |
destructive | Irreversible actions — delete, leave, discard |
size
Density. md is the default and matches the rest of the form
controls; sm for dense toolbars, lg for hero CTAs.
| Value | Min height | Padding (horizontal) |
|---|---|---|
sm | 32 px | 12 px |
md (default) | 36 px | 16 px |
lg | 44 px | 20 px |
loading and disabled
loading swaps the leading icon (or label, in icon-only buttons) for a
Spinner and disables interaction. The
button keeps its width so the layout doesn't jump when the request
returns. disabled greys the button out and blocks press handling
without showing a spinner.
Both forward aria-busy / aria-disabled so screen readers narrate
the state correctly.
leadingIcon and trailingIcon
Two icon slots — pass any component matching
{ size?: number; color?: string }. Sized automatically to match the
button's size. The Button renders nothing for an empty slot, so a
text-only button stays text-only.
In loading state the leadingIcon is replaced by a Spinner; the
trailingIcon stays so the right-edge layout doesn't jump.
asChild
Renders the supplied child as the interactive root, so a Button can
render as a Next.js <Link> (or any other element) while keeping all
of its styles and accessibility behavior. Common for full-card
clickable areas and routed actions.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — | If true, the single child becomes the interactive element (Slot pattern). |
className | string | — | — |
disabled | boolean | — | — |
leadingIcon | IconSlot | — | — |
loading | boolean | — | — |
ref | Ref<View> | — | — |
size | enum | md | — |
trailingIcon | IconSlot | — | — |
variant | enum | primary | — |