Button
Triggers an action with primary, secondary, or destructive emphasis.
button-basic-demo.tsx
Installation
The CLI adds the files, packages, theme variables, and Tailwind plugin that this component uses. Before you run it, set up your project.
npm
yarn
pnpm
bun
Variants
button-variants-demo.tsx
Sizes
Use xs in table rows, sm in toolbars, md for most actions, and xl for a main call to action.
button-sizes-demo.tsx
With icon
Set aria-hidden on the icon so the label stays the accessible name.
button-with-icon-demo.tsx
Loading
Set isPending while a task runs. The button keeps focus and ignores presses. Also install Spinner.
button-loading-demo.tsx
Link
To use your router, pass its link component to the as prop. Also install Button link.
button-link-demo.tsx
API reference
vip/ui adds or changes the props below. For all other props, see React Aria Button (opens in a new tab).
- variant: "default" | "secondary" | "outline" | "ghost" | "minimal" | "destructive" = "default"
- Choose the action's visual priority. Minimal is for a quiet icon action.
- size: "xs" | "sm" | "md" | "lg" | "xl" = "md"
- Heights are 28, 36, 44, 48, and 56 pixels. Inside a sized Toolbar, ButtonGroup, or ToggleButtonGroup, the group size applies. On touch screens, the touch area is at least 44 pixels high.
- iconOnly: boolean = false
- Makes the button a square for one icon. Give the button an aria-label.
- static: boolean = false
- Disable press scaling while keeping the button interactive.
- layout: MotionProps["layout"]
- Animate position or size changes when the button moves in the layout. Ignored when reduced motion is requested.