ACTIONS / COMPONENT 01

Button

React component

Trigger an action with clear hierarchy and immediate feedback.

Try it out

Use the live controls or open the Code tab to view and copy the example.

API reference

Generated from the package’s TypeScript exports. Standard React event and ARIA attributes are also accepted where the component wraps a native element.

PropTypeDescription
variant"primary" | "secondary" | "tertiary" | undefinedDefault: "secondary"Visual emphasis appropriate to the action hierarchy.
tone"neutral" | "critical" | undefinedDefault: "neutral"Semantic status treatment; always pair color with text.
sizeSize | undefinedDefault: "medium"Size within the shared component scale.
loadingboolean | undefinedStandard React / HTML attribute passed to the underlying element.
iconReactNodeSee the typed definition and working example for this option.
fullWidthboolean | undefinedSee the typed definition and working example for this option.
asChildboolean | undefinedSee the typed definition and working example for this option.
disabledboolean | undefinedDisables interaction (or date matchers for DatePicker).
namestring | undefinedField name used in form submission.
type"submit" | "reset" | "button" | undefinedDefault: "button"Standard React / HTML attribute passed to the underlying element.
valuestring | number | readonly string[] | undefinedControlled value. Pair with its change callback.
defaultCheckedboolean | undefinedStandard React / HTML attribute passed to the underlying element.
defaultValuestring | number | readonly string[] | undefinedInitial value for uncontrolled usage.
classNamestring | undefinedAdditional CSS class names.
idstring | undefinedStandard React / HTML attribute passed to the underlying element.
styleCSSProperties | undefinedInline styles, including CSS custom property overrides.
relstring | undefinedStandard React / HTML attribute passed to the underlying element.
childrenReactNodeContent rendered inside the component.
onFocusFocusEventHandler<HTMLButtonElement> | undefinedStandard React / HTML attribute passed to the underlying element.
onBlurFocusEventHandler<HTMLButtonElement> | undefinedStandard React / HTML attribute passed to the underlying element.
onChangeChangeEventHandler<HTMLButtonElement, Element> | undefinedStandard React / HTML attribute passed to the underlying element.
onErrorReactEventHandler<HTMLButtonElement> | undefinedStandard React / HTML attribute passed to the underlying element.
onClickMouseEventHandler<HTMLButtonElement> | undefinedStandard React / HTML attribute passed to the underlying element.

Accessibility & interaction

Maintain an understandable accessible name and preserve visible focus for all actions.

Visible focus, reduced motion, and both color themes are shared across staqui. Choose labels and document structure that make sense in your application; automated checks do not replace assistive-technology testing.

Variants & implementation notes

Pill-shaped buttons come in three variants. Use primary for the main action, secondary for supporting actions, and tertiary for quieter actions. Apply the critical tone to destructive actions at any level of emphasis. Small, medium, and large have minimum heights of 28px, 34px, and 42px. Use fullWidth to fill the available space. On native buttons, loading disables interaction and centers a spinner while preserving the button width. Use asChild with a single link for navigation.

Use the typed API above for the supported variants. The example demonstrates the primary composition; shared controls inherit hover, focus, active and disabled treatment where applicable.

Compose with