Button
A clickable trigger for actions, forms, and navigation.
Import
Usage
Examples
Color
Variant
Size
Radius
Disabled
Loading state
Icon-only
Full width
With animation
Props
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "solid" | "ghost" | "bordered" | "faded" | "underlined" | "bordered"* | Visual style of the button |
color | "none" | "default" | "primary" | "secondary" | "danger" | "warning" | "success" | "primary"* | Semantic color |
size | "sm" | "md" | "lg" | "md" | Size scale |
radius | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "full" | "md"* | Corner rounding |
animate | boolean | true | Enables hover/tap motion |
fullWidth | boolean | false | Stretches to fill container width |
isDisabled | boolean | false | Disables interaction |
isLoading | boolean | false | Shows a spinner and disables interaction |
icon | boolean | false | Icon-only mode, requires aria-label |
type | "button" | "submit" | "reset" | "button" | Button type attribute |
className | string | None | Extra classes, merged with internal styles |
* Falls back through Global Configuration if not set. See below.
Global Configuration
Button reads defaults from four places, in this order of precedence:
- Instance prop: set directly on
<Button /> - Component config:
components.buttonin yourashee.config - Theme default:
defaultVariant/defaultColor/defaultRadiusin yourashee.config - Built-in fallback: component's internal default values
Component config
Built-in fallbacks
Accessibility
- Renders a native
<button>element with the appropriatetype isLoadingsetsaria-busyand hides button text from assistive tech while the spinner is visible- Icon-only buttons (
icon) require anaria-label - Disabled and loading states are exposed via
aria-disabled - Implements
focus-visiblering for keyboard navigation
Notes
- Icon-only buttons: When using
icon, you must provide anaria-labelfor accessibility. - Loading state: The button text is hidden from screen readers while
isLoadingistrue. The spinner provides the visual feedback. - Animation: The
animateprop adds a subtle scale effect on click. It's enabled by default. - Full width: When
fullWidthistrue, the button expands to fill its container width.