Button
An action trigger with default, outline, secondary, ghost, destructive, and link variants.
When to use
- Use when
- Triggering an action: submitting, saving, opening, or confirming.
- Avoid when
- Navigating to another page; use a link, which can look like a Button.
Installation
The source lands in src/components/ui/button.tsx, along with any Shelf items it builds on, and .shelf/lock.json records what was installed. It's yours to edit.
Usage
Examples
Sizes
With icon
Icons sit before or after the label. Icon-only buttons need an accessible label.
Loading
Disable the button and show a Spinner while the action runs.
Built on
- Packages
@base-ui/react,@stylexjs/stylex- Shelf items
foundations,utils- Accessibility
- Focus, keyboard, and ARIA behavior come from Base UI.
- Figma
- Optional native Figma library. See Designers.
Verified
- Size
- 3.0 kB gzipped on its own, 7.6 kB with the Shelf items and packages it builds on. JS and CSS in a production build, without React.
- Accessibility
- Axe passes on 19 stories
- Behavior
- 17 interaction tests in Storybook
- React Doctor
- React Doctor finds nothing