Button

Six variants, four sizes, icon-only sizes, and a link mode — with a spring press-scale action that collapses under reduced-motion.

Install

import { Button } from '$lib/components/ui/button';

Variants

States

default
outline
secondary
ghost
destructive
link

Sizes

With icons

Loading

Compose Spinner inline and set disabled while the action is in-flight. Click to simulate a 2 s load.

Radius

Pill is the default — the signature primary CTA and FAB shape. Pass radius="default" to opt into a rounded square via --radius for tabular or utility surfaces.

Fuse adjacent buttons into a single control with shared borders and flush corners — see the Button Group page for full examples.

API reference

Inherits every native HTML button or anchor attribute via spread. Switches to <a> when href is set.

PropTypeDescription
'default' | 'outline' | 'secondary' | 'ghost' | 'destructive' | 'link'Visual style. Link variant collapses to an underlined text affordance.
'default' | 'xs' | 'sm' | 'lg' | 'icon' | 'icon-xs' | 'icon-sm' | 'icon-lg'Controls height and horizontal padding. Icon sizes render as a square.
'default' | 'pill'Corner shape. Pill (default) uses --radius-control (9999px) — same tier as inputs and selects. Pass radius="default" for a rounded square via --radius on tabular or utility surfaces.
string | undefinedWhen set, the button renders as an anchor and receives link semantics.
booleanDisables the control. Anchors receive aria-disabled and tabindex=-1 instead of a native disabled attribute.
'button' | 'submit' | 'reset'Passed through when rendering as a <button>. Ignored when href is set.
HTMLButtonElement | HTMLAnchorElement | nullTwo-way-bindable element reference.
stringMerged onto the root via tailwind-merge. Useful for spacing or width overrides.