structyl

Button API

View component

The full prop reference for the Button component. A clickable control with six variants and four sizes, complete with spring-press feedback.

Import

tsx
import { Button } from '@structyl/styled';

Props

Button

Styled button component with variant system, icon slots, and loading state. Extends native HTML button with semantic styling and layout options.

PropTypeDefault
variant#'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link' | 'success' | 'warning' | 'contained' | 'outlined' | 'text'

Visual variant; legacy variants (default, destructive, etc.) are self-contained; MUI-style variants (contained, outlined, text) pair with color prop

'default'
color#'primary' | 'secondary' | 'error' | 'warning' | 'info' | 'success' | 'default' | 'inherit'

Semantic color; used with MUI-style variants (contained, outlined, text) or standalone with inherit

size#'default' | 'sm' | 'lg' | 'xl' | 'icon' | 'icon-sm' | 'icon-lg' | 'icon-xl'

Button size; icon-* variants are square (height === width)

'default'
asChild#boolean

Replace button element with Slot child element, merging props and classes

loading#boolean

Shows spinner icon, disables button, replaces children with loadingText if provided

false
loadingText#string

Text displayed next to spinner when loading; defaults to children if not provided

leftIcon#React.ReactNode

Icon or element rendered before children

rightIcon#React.ReactNode

Icon or element rendered after children

disabled#boolean

Disables button interaction; also set when loading=true

className#string

Additional CSS classes merged with variant styles

type#'button' | 'submit' | 'reset'

HTML button type attribute

'button'
children#React.ReactNode

Button content

ButtonGroup

Container for grouping buttons with shared prop propagation and optional border-collapse styling.

PropTypeDefault
attached#boolean

Collapses shared borders between adjacent buttons and adjusts border-radius

false
orientation#'horizontal' | 'vertical'

Layout direction of grouped buttons

'horizontal'
variant#'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link' | 'success' | 'warning' | 'contained' | 'outlined' | 'text'

Variant propagated to all child Button components

color#'primary' | 'secondary' | 'error' | 'warning' | 'info' | 'success' | 'default' | 'inherit'

Color propagated to all child Button components

size#'default' | 'sm' | 'lg' | 'xl' | 'icon' | 'icon-sm' | 'icon-lg' | 'icon-xl'

Size propagated to all child Button components

disabled#boolean

Disabled state propagated to all child Button components

fullWidth#boolean

Makes each child Button full-width; propagated to all children

className#string

Additional CSS classes for the group container

children#React.ReactNode

Button components to group

ButtonSpinner

SVG spinner icon used internally during loading state; exported for custom loading UI.

PropTypeDefault
className#string

Additional CSS classes (animate-spin is applied by default)

Keyboard interactions

KeyDescription
SpaceActivates the button.
EnterActivates the button.

Source code

If you didn't find what you need here, read the component implementation .

structyl — Accessible React Component Library