Button

Triggers an action or event

Category: inputs · WCAG 2.2-AA · action, form, interactive

Variants

Sizes

States

Props

PropTypeDefaultDescription
variant'primary' | 'secondary' | 'ghost' | 'destructive'primarySelects the visual style variant.
size'sm' | 'md' | 'lg'mdVisual size of the component (e.g. 'sm', 'md', 'lg').
loadingbooleanfalseWhen true, shows a loading state.
disabledbooleanfalseWhen true, disables the control and removes it from the tab order.
asChildbooleanfalseWhen true, renders the child element as the root via Slot, merging props (polymorphic rendering).
onClickReact.MouseEventHandler<HTMLButtonElement>Called when the element is clicked.

Design tokens

When to use

When not to use

How to build an accessible Button in React →

Examples

Primary

<Button>Click me</Button>

Loading

<Button loading>Saving…</Button>

Destructive

<Button variant="destructive">Delete</Button>

As link

Render button styling on a real anchor (keeps middle-click / open-in-new-tab).

<Button asChild><a href="/pricing">View pricing</a></Button>

Related components

← Back to docs