Button

An action, in four variants and three sizes; render draws one as another element, such as a link.

Installation

Examples

Default

demo.tsx

Variants

default for most actions, primary for the main one, flat for actions that sit quietly in a header, and ghost for actions in a bar.

variants.tsx

Sizes

sm and lg sit beside an Input or a Select of the same size. A theme can scale all three.

sizes.tsx

With an icon

A leading icon sits 4px closer to the edge, since its box has air around the stroke.

icon.tsx

render draws the button as another element, such as a link, with its props merged in.

link.tsx

Anatomy

Each part's data-slot, which a theme styles, is beside it.