Playground
Change the props and copy the code. The controls come from the component's TypeScript types.
Props
variant
size
import { Button } from "@/components/ui/button";<Button>Save changes</Button>Installation
$ pnpm dlx shadcn@latest add @synccn/buttonFirst time in this project? Connect synccn with one command.
Usage
import { Button } from "@/components/ui/button";<Button variant="outline" size="sm">Export</Button>API reference
Generated from the component's TypeScript types, so it always matches the code.
PropTypeDescription
- variant
"default" | "secondary" | "outline" | "ghost" | "destructive" | "link" | "soft"Default
"default"Visual style.
- size
"sm" | "default" | "lg" | "icon" | "icon-sm"Default
"default"Height and padding.
- loading
booleanDefault
falseShows a spinner and disables the button.
- className
stringExtra classes for the root element.
- children
React.ReactNodeContent to render.
Also accepts every standard <button> attribute, and forwards its ref.
Dependencies
Read from the component's imports when the site builds. The CLI installs all of these for you.
Helpers
- lib/utilscn (merges class names)
npm packages
- clsx for cn()
- tailwind-merge for cn()
- lucide-react for Loader2
Accessibility
From the source
Read from this component's code when the site builds, so it can't drift.
- ARIA attributes: aria-busy
- Shows a visible focus ring for keyboard users
More inputs
InputText field with optional leading icon and invalid state.TextareaMulti-line field that grows with its content and counts characters.CheckboxChecked, unchecked and indeterminate, with label and description.SwitchToggle with a springy thumb in three sizes.Radio GroupPick one option, shown as dots or as selectable cards.SliderSingle value or range, with keyboard steps and value bubbles.