View fulldotdev/ui on GitHub

Button

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

Installation

npx shadcn@latest add @fulldev/button

Usage

import { Button } from "@/components/ui/button"
<Button variant="outline">Button</Button>

Button renders a button with type="button", or an a when you pass href. Pass as to render another element, such as as="label". Use type="submit" explicitly for form submission. buttonVariants gives the same classes to a custom element.

Size

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

Default

Outline

Secondary

Ghost

Destructive

Icon

With Icon

Add data-icon="inline-start" or data-icon="inline-end" to the icon for the correct spacing.

Rounded

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

Spinner

Render a Spinner inside the button to show a loading state, with data-icon="inline-start" or data-icon="inline-end".

Button Group

Use ButtonGroup to group related buttons. See Button Group. The official example on this page uses a dropdown submenu, so it is in the React Button docs only.

With href, Button renders a real a element, so the link keeps its link role.

RTL

API Reference

Source: src/components/ui/button

PropTypeDefault
variant"default" | "outline" | "ghost" | "destructive" | "secondary" | "link""default"
size"default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg""default"
asHTML tag"a" with href, else button

Button writes its variant and size to data-variant and data-size, as shadcn/ui does, so a parent can style it, such as has-data-[variant=outline]:gap-2.