structyl

Button

stable

A clickable control with six variants and four sizes, complete with spring-press feedback.

Basic usage

Examples

Sizes

Four sizes — sm, default, lg, and icon — plus a disabled state.

Variants and sizes

Preview the common visual variants, icon affordance and disabled state together.

Color palette

Use the color prop with contained, outlined, and text variants for semantic intent.

Features

  • Six visual variants and four sizes.
  • Spring-eased press animation on tap.
  • Supports `asChild` to render any element.
  • Full keyboard and screen-reader support.

Installation

bash
pnpm dlx structyl add button

API Reference

Button

The button element.

PropTypeDefault
variant'default' | 'secondary' | 'outline' | 'ghost' | 'link' | 'destructive'

Visual style.

'default'
size'default' | 'sm' | 'lg' | 'icon'

Control size.

'default'
asChildboolean

Merge props onto the child element instead of rendering a button.

false
disabledboolean

Disable the button.

false

Keyboard interactions

KeyDescription
SpaceActivates the button.
EnterActivates the button.
Button | structyl