Toggle Sidebar B
AppearanceLight & dark mode D
Button
Displays a button or a component that looks like a button.
Demo
Replay preview
Size
Use the size prop to change the size of the button.
Replay preview
Default
Replay preview
Outline
Replay preview
Secondary
Replay preview
Ghost
Replay preview
Destructive
Replay preview
Outline Destructive
An outline button that reads as destructive. Use it when the action is dangerous but not the primary one on screen.
Replay preview
Link
Replay preview
Icon
Replay preview
With Icon
Remember to add the data-icon inline-start or inline-end attribute to the icon for the correct spacing.
Replay preview
Rounded
Use the rounded-full class to make the button rounded.
Replay preview
Spinner
Render a Spinner component inside the button to show a loading state.
Replay preview
Button Group
Wrap buttons in ButtonGroup to join them into a single control.
Replay preview
As Link
Apply buttonVariants to any element (like an anchor) to make it look like a button.
Replay preview
API Reference
Button
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "default" | "secondary" | "outline" | "outline-destructive" | "destructive" | "ghost" | "link" | "default" | Visual style. |
size | "xs" | "sm" | "default" | "lg" | "xl" | "icon" | "iconXs" | "iconSm" | "iconLg" | "default" | Height and padding. Every size is one step taller on phones and settles to its desktop height at the sm breakpoint, and the label follows the same ladder in reverse (text-base, then text-sm from sm up). xl is one step above lg, for hero and landing CTAs; it has no icon-only counterpart. Icon sizes also accept the kebab aliases icon-xs, icon-sm, and icon-lg. |
to | string | — | Renders as NuxtLink when set. External URLs (http) open in a new tab. |
as | string | "button" | HTML element to render when to is empty. |
asChild | boolean | false | Render the child slot without a wrapper element. |
class | string | — | Extra classes, merged with cn(). |
| Slot | Description |
|---|---|
default | Button label and icons. |