Primitives
Button
Primary action element with 4 variants, 3 sizes, 3 square icon sizes and a loading state. An icon goes in as a child, before or after the label. buttonVariants lives in its own file with no use client, so a server component can style a link as a button.
Preview
variants
with an icon
icon only
sizes
states
Installation
Resolves dependencies, copies the source, and installs npm packages automatically.
Usage
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "primary" | "secondary" | "ghost" | "command" | "primary" | Visual style variant |
| size | "sm" | "md" | "lg" | "icon-sm" | "icon-md" | "icon-lg" | "md" | Height and padding. The icon sizes are square: name the button with aria-label |
| loading | boolean | false | Shows spinner and disables the button |
| asChild | boolean | false | Delegates rendering to child via Radix Slot |