Toggle Sidebar B
AppearanceLight & dark mode D

Button

Displays a button or a component that looks like a button.

Demo

Dark previewReplay preview

Size

Use the size prop to change the size of the button.

Dark previewReplay preview

Default

Dark previewReplay preview

Outline

Dark previewReplay preview

Secondary

Dark previewReplay preview

Ghost

Dark previewReplay preview

Destructive

Dark previewReplay preview

Outline Destructive

An outline button that reads as destructive. Use it when the action is dangerous but not the primary one on screen.

Dark previewReplay preview

Icon

Dark previewReplay preview

With Icon

Remember to add the data-icon inline-start or inline-end attribute to the icon for the correct spacing.

Dark previewReplay preview

Rounded

Use the rounded-full class to make the button rounded.

Dark previewReplay preview

Spinner

Render a Spinner component inside the button to show a loading state.

Dark previewReplay preview

Button Group

Wrap buttons in ButtonGroup to join them into a single control.

Dark previewReplay preview

API Reference

Button

PropTypeDefaultDescription
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.
tostringRenders as NuxtLink when set. External URLs (http) open in a new tab.
asstring"button"HTML element to render when to is empty.
asChildbooleanfalseRender the child slot without a wrapper element.
classstringExtra classes, merged with cn().
SlotDescription
defaultButton label and icons.