Skip to content

Button

Props

PropTypeDefaultOptionsDescription
appearancestring"primary"primary, secondary, ghost, tertiaryVisual weight of the button. tertiary is only valid with purpose="utility" (neutral subtle fill, no border); otherwise the button renders as primary (dev warning).
sizestring"m"xs, s, m, lControls dimensions, padding, and typography. xs is only valid with purpose="utility"; otherwise the button renders as s (dev warning).
intentstring"default"default, dangerSemantic intent — changes the color scheme. danger is only supported with appearance primary or ghost; other appearances render as primary + danger (dev warning).
purposestring"main"main, utilityLayout role: main (pill) or utility (squared corners)
disabledbooleanfalseDisables the button and applies disabled styles
loadingbooleanfalseBusy state: aria-busy="true", native disabled, and class catnip-button--loading. Interim: using full disabled styling/behavior for loading is temporary until UX finalizes the loading design (semantics stay: busy + non-interactive). Add your own spinner via slots / icons.
selectedbooleanfalseToggle / selected-on state for purpose="utility" only; ignored otherwise (dev warning). Sets aria-pressed="true" and class catnip-button--selected. Primary: strong pressed background with on-primary text. Secondary, ghost, tertiary: primary subtle background, primary strong border, primary strong text.
leftIconstring""Valid CatnipIconNameIcon name for the left position
rightIconstring""Valid CatnipIconNameIcon name for the right position
ariaLabelstring""Accessible label — required for icon-only buttons
typestring"button"button, submit, resetNative button type attribute
namestring""Native name — optional; use with forms (submit/reset) or when you need a stable identifier in the DOM
valuestring""Native value — submitted with name for submit / reset
formstring""Native form — id of a <form> when the button is not a descendant of that form
autofocusbooleanfalseNative autofocus — use sparingly (accessibility: prefer explicit focus management in modals)
testSelectorsobjectSee Test SelectorsOverride data-test attributes for testing

See Component API — Props.

Slots

NameDescription
leftIconSlotCustom left icon position. Overrides the leftIcon prop. Accepts <catnip-icon>, SVGs, or any element.
(default)Button text. When empty and an icon is provided, the button uses icon-only layout automatically.
rightIconSlotCustom right icon position. Overrides the rightIcon prop. Accepts <catnip-icon>, counters, or any element.

See Component API — Slots.

Test Selectors

AttributeDefault Value
rootcatnip-button

See Component API — Test selectors.

Catnip Design System by Signicat