Installation
Usage
Props
Visual style of the button.Options:
default, secondary, destructive, outline, ghost, linkSize of the button.Options:
xs, sm, md, lg, xl, icon-xs, icon-sm, icon, icon-lg, icon-xlWhen true, displays a loading spinner and disables the button.
Disables the button and prevents interaction.
Custom render function from @base-ui/react’s useRender hook for polymorphic rendering.
Variants
The Button component uses class-variance-authority (CVA) for variant management:- default: Primary button with filled background
- secondary: Secondary style with muted appearance
- destructive: Red/destructive actions
- outline: Border with transparent background
- ghost: Minimal style with no border
- link: Text-only with underline on hover
Sizes
Regular sizes:xs (h-7), sm (h-8), md (h-8.5), lg (h-9), xl (h-9.5)
Icon sizes: icon-xs through icon-xl for square icon-only buttons
Examples
Variants
Sizes
With Icons
Loading State
Accessibility
Built on @base-ui/react for full accessibility support:- Semantic
<button>element by default - Keyboard navigation support
- Focus visible ring on keyboard focus
aria-busyattribute when loading- Proper disabled state handling