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:- Primary
- Secondary
- Tertiary
- Danger
Sizes
Buttons come in four sizes to fit different use cases:The default size is
md if not specified.States
Disabled State
Loading State
Full Width
Props
string
default:"primary"
Visual style variant:
primary, secondary, tertiary, or dangerstring
default:"md"
Button size:
sm, md, lg, or xlboolean
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) => voidstring
default:"button"
HTML button type:
button, submit, or resetReactNode
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
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