Loading component…
Loading component…
Primary, secondary, ghost and destructive buttons with icons, sizes and a shimmering loading state
To reuse this local React demo, copy all files from the Code tab into the same folder, then import Button from ./button.
import { Button } from "@/components/ui/button";
export function Actions() {
return (
<>
<Button variant="ghost">Cancel</Button>
<Button>Save changes</Button>
</>
);
}| Name | Type | Default | Description |
|---|---|---|---|
| variant | "primary" \| "secondary" \| "ghost" \| "destructive" | "primary" | Dark filled, white with an outline, text only, or red for deleting |
| size | "sm" \| "md" \| "lg" | "md" | 32, 40 or 48px high |
| loading | boolean | false | Swaps the left icon for a spinner, shimmers the label, sets aria-busy and ignores clicks |
| icon | ReactNode | Icon before the label; without children the button becomes square | |
| iconRight | ReactNode | Icon after the label | |
| ...props | button attributes | Everything a native button takes, including ref, type and disabled |
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"
@import "tailwindcss"; in your main CSS file.