Basic usage
Props
'solid' | 'outline' | 'ghost' | 'text'
default:"'solid'"
The visual style variant of the button.
'accent' | 'danger' | 'neutral' | 'success'
default:"'accent'"
The color theme of the button.
'small' | 'normal'
default:"'normal'"
The size of the button.
boolean
Whether the button is disabled.
boolean
Whether the button is in a loading state. Shows a spinner when true.
ReactNode
Text to display alongside the loading spinner.
ReactNode
Icon element to display before the button text.
ReactNode
Icon element to display after the button text.
string | number
Maximum width of the button.
string | number
Width of the button.
React.CSSProperties
Additional inline styles to apply to the button.
string
Additional CSS classes to apply to the button.
ReactNode
The content to display inside the button.
Variants
Solid
The default filled button style.Outline
A button with a border and transparent background.Ghost
A minimal button with no border or background in its default state.Text
A text-only button with no background or border.Colors
Sizes
With icons
Loading state
Disabled state
Custom width
Accessibility
- The Button component is built on Base UI’s Button primitive, ensuring proper accessibility.
- It maintains focus states and keyboard navigation.
- When in loading state, the button becomes focusable even when disabled using
focusableWhenDisabled. - Ensure to provide meaningful button text or
aria-labelfor icon-only buttons.