Button

A button for primary actions and form submits. Wraps a native <button> (so it accepts type, onClick, and the rest of the button attributes) and adds variants, sizes and a loading state.

Variants

primary is an inverted (ink-on-background) fill for the main action; secondary is a bordered neutral button; ghost is transparent with a hover tint (for low-emphasis / list actions); danger is for destructive actions; link renders as inline underlined text with no padding.

Sizes & states

Three sizes (sm, md, lg). loading shows a spinner and disables the button; disabled greys it out and blocks clicks.

Props

PropTypeDefaultDescription
variant'primary' | 'secondary' | 'ghost' | 'danger' | 'link''primary'Visual style. 'destructive' is also accepted as an alias for 'danger'.
size'sm' | 'md' | 'lg''sm'Padding/text scale.
loadingbooleanfalseShows a spinner and disables the button.
leftIconReactNodeIcon rendered before the label.
iconbooleanfalseSquare icon-button padding (for a button whose content is a single icon).
valuebooleanfalseActive/selected state — renders the label and icon in the accent color.
asChildbooleanfalseRender the single child element with the button styling instead of a <button> (merging classes and forwarding props).
disabledbooleanfalseDisables interaction.
type'button' | 'submit' | 'reset''button'Native button type.
classNamestringExtra classes on the button.

Any other native <button> attributes (onClick, aria-*, …) are forwarded.

buttonVariants

buttonVariants(options) returns the composed class string for a button without rendering one. Accepts variant, size, icon, value, and className, and is useful for styling a non-button element (like a link) to match the button set.