Components
- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Code Block
- Collapsible
- Combobox
- Command
- Context Menu
- Copy Button
- Data Table
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Form
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- Menubar
- Native Select
- Navigation Menu
- Page Header
- Pagination
- Panel
- Popover
- Progress
- Radio Group
- Resizable
- Scroll Area
- Section Header
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Stat
- Stat Card
- Switch
- Table
- Tabs
- Textarea
- Theme Toggle
- Toggle
- Toggle Group
- Tooltip
Button
Displays a button or a component that looks like a button.
01
Installation
Add the button component with the shadcn CLI.
bash
npx shadcn@latest add https://swiss.ui.unsanity.ai/r/button.json02
Usage
tsx
import { Button } from "@/components/ui/button"
<Button>Button</Button>03
Examples
Variants
import { Button } from "@/components/ui/button"
<div className="flex flex-wrap gap-2">
<Button>Default</Button>
<Button variant="secondary">Secondary</Button>
<Button variant="outline">Outline</Button>
<Button variant="ghost">Ghost</Button>
<Button variant="destructive">Destructive</Button>
<Button variant="link">Link</Button>
</div>Sizes
import { SettingsIcon } from "lucide-react"
import { Button } from "@/components/ui/button"
<div className="flex flex-wrap items-center gap-2">
<Button size="sm">Small</Button>
<Button>Default</Button>
<Button size="lg">Large</Button>
<Button size="icon" aria-label="Settings">
<SettingsIcon />
</Button>
</div>