Skip to main content

Overview

The Button component is a foundational interactive element that triggers actions when clicked. It supports multiple visual styles, sizes, and states.

Basic Usage

Variants

The Button component supports multiple visual variants:
The primary variant is used for main actions. It features a solid background with high contrast.

Sizes

Buttons come in four sizes to fit different use cases:
The default size is md if not specified.

States

Disabled State

Disabled buttons cannot be interacted with and appear visually muted.

Loading State

The loading state shows a spinner and prevents interaction while an async operation is in progress.

Full Width

Props

string
default:"primary"
Visual style variant: primary, secondary, tertiary, or danger
string
default:"md"
Button size: sm, md, lg, or xl
boolean
default:"false"
Whether the button is disabled and cannot be interacted with
boolean
default:"false"
Shows a loading spinner and prevents interaction
boolean
default:"false"
Makes the button expand to fill its container width
function
Click event handler: (event: React.MouseEvent) => void
string
default:"button"
HTML button type: button, submit, or reset
ReactNode
required
The content to display inside the button
string
Additional CSS class names to apply
ReactNode
Optional icon to display before the button text

TypeScript Interface

Advanced Examples

Button with Icon

Async Button

Use the loading prop with async operations to provide visual feedback to users.

Accessibility

  • Supports keyboard navigation (Enter and Space keys)
  • Includes proper ARIA attributes when disabled or loading
  • Maintains focus management for keyboard users
  • Color contrast meets WCAG AA standards