Marker

Primitive

Button

Runs an action when pressed: save, post, download, confirm.

When to use

Use it for actions. Render it as a link with render={<a href />} only when a navigation needs a button's weight, such as a page's main call to action. A link inside text stays a link.

States

Variants
Sizes
With an iconThe icon side gets 2px less padding, which reads as even.
Icon only
Disabled
LoadingThe label stays as the accessible name and the width holds. Under reduced motion the spinner pulses instead of turning.
As a link

Props

PropTypeDefaultDescription
variant"primary" | "secondary" | "ghost" | "danger"Default "secondary"primary marks the one main action in a view. ghost is for toolbars and actions beside content. danger is for an action that destroys data, and its label names what is lost.
size"sm" | "md" | "lg"Default "md"sm (28px) for toolbars and table rows, md (32px) for most places, lg (40px) for a form's submit.
iconOnlytrueDefault –A square that holds one icon. It requires a name: aria-label, which names the action ("Delete journal", not "Trash"), or aria-labelledby, the id of visible text that names it. One of the two.
loadingbooleanDefault falseShows a spinner over the label, keeps the width and keeps focus. Presses do nothing: onClick and formAction are held back and a submit button stops submitting. Not allowed with render.
disabledbooleanDefault falseThe native disabled attribute: the Button leaves the tab order and ignores presses. Not allowed with render.
renderReactElementDefault –Renders this element with the Button's look, such as <a href="/ledger" />. Its own props win over the Button's.
type"button" | "submit" | "reset"Default "button"Set "submit" for a form's submit button. Ignored with render.
...button propsComponentProps<"button">Default –Passed to the element, ref and aria-* included. className places the Button and never restyles it.