Button
Native <button> is styled by default. Add .btn to links that should look like buttons.
How it helpsNo wrapper component and no classes for the common case. Variant, size, tone and loading are plain attributes, so they work from any framework or template.
Variants
export default function Example() {
return (
<>
<button>Primary</button>
<button data-variant="ghost">Ghost</button>
<button data-variant="quiet">Quiet</button>
<button data-variant="soft">Soft</button>
<button data-tone="bad">Delete</button>
<a className="btn" href="#/button" data-tone="ink">Link button</a>
</>
);
}<button>Primary</button>
<button data-variant="ghost">Ghost</button>
<button data-variant="quiet">Quiet</button>
<button data-variant="soft">Soft</button>
<button data-tone="bad">Delete</button>
<a class="btn" href="#/button" data-tone="ink">Link button</a>Sizes, icons & states
export default function Example() {
return (
<>
<button data-size="sm">Small</button>
<button>Medium</button>
<button data-size="lg"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><path d="M12 5v14M5 12h14"/></svg> Large</button>
<button data-size="icon" aria-label="Add"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><path d="M12 5v14M5 12h14"/></svg></button>
<button aria-busy="true">Saving</button>
<button disabled>Disabled</button>
</>
);
}<button data-size="sm">Small</button>
<button>Medium</button>
<button data-size="lg"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 5v14M5 12h14"/></svg> Large</button>
<button data-size="icon" aria-label="Add"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 5v14M5 12h14"/></svg></button>
<button aria-busy="true">Saving</button>
<button disabled>Disabled</button>Any colour
export default function Example() {
return (
<>
<button style={{ "--tone": "#7c3aed" }}>Violet</button>
<button style={{ "--tone": "#b4532a" }}>Clay</button>
<button data-variant="soft" style={{ "--tone": "#3b6fd4" }}>Soft blue</button>
</>
);
}<button style="--tone:#7c3aed">Violet</button>
<button style="--tone:#b4532a">Clay</button>
<button data-variant="soft" style="--tone:#3b6fd4">Soft blue</button>API
| Name | Type | Description |
|---|---|---|
data-variant | ghost | quiet | soft | Default is solid. |
data-size | sm | lg | icon | Default is 36px tall. |
data-tone / --tone | colour | Fill colour. |
aria-busy="true" | attr | Shows a spinner and blocks clicks. |
disabled | attr | Native disabled. Use aria-disabled="true" on .btn links. |