- Accordion
- Action Bar
- Action Toast
- Alert Banner
- Alert Dialog
- Alert
- Alphabet Index
- Amount Field
- Aspect Ratio
- Attachment
- Availability List
- Avatar
- Badge
- Bank Card
- Breadcrumb
- Bubble
- Button Group
- Button
- Calendar
- Camera Frame
- Card Design Picker
- Card Details
- Card Peek
- Card Stack
- Card
- Carousel
- Chart
- Chat Thread
- Checkbox
- Chip Group
- Choice Tile
- Code Block
- Code Dots
- Collapsible
- Combobox
- Command
- Context Menu
- Copy Field
- Countdown
- Country Select
- Data Table
- Date Field
- Date Picker
- Date Range Picker
- Dialog
- Direction
- Document Paper
- Drawer
- Dropdown Menu
- Empty
- Entity Avatar
- Field
- File Trigger
- File Upload Item
- Hover Card
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Key Value
- Keypad
- Label
- Live Region
- Marker
- Message Scroller
- Message
- Money Amount
- Native Select
- Number Field
- Pagination
- Percent Split Editor
- Phone Field
- Popover
- Progress
- QR Code
- Questionnaire
- Radio Group
- Range Histogram
- Rating
- Resizable
- Scroll Area
- Search Field
- Select
- Separator
- Share Bar
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Sortable List
- Spinner
- Status Timeline
- Step Header
- Steps List
- Swipe Row
- Switch
- Table
- Tabs
- Text Field
- Textarea
- Tier Ladder
- Toggle Group
- Toggle
- Token Search Field
- Tooltip
- Trace
- Transaction Row
- Usage Meter
import { ArrowUpIcon } from "lucide-react"
import { Button } from "@/components/ui/button"
Installation#
pnpm dlx shadcn@latest add @dots/button
Usage#
import { Button } from "@/components/ui/button"<Button variant="outline">Button</Button>Cursor#
Tailwind v4 switched from cursor: pointer to cursor: default for the button component.
If you want to keep the cursor: pointer behavior, add the following code to your CSS file:
You can also enable this during project setup with npx shadcn@latest init --pointer.
@layer base {
button:not(:disabled),
[role="button"]:not(:disabled) {
cursor: pointer;
}
}Size#
Use the size prop to change the size of the button.
import { ArrowUpRightIcon } from "lucide-react"
import { Button } from "@/components/ui/button"
Default#
import { Button } from "@/components/ui/button"
export function ButtonDefault() {
Outline#
import { Button } from "@/components/ui/button"
export function ButtonOutline() {
Secondary#
import { Button } from "@/components/ui/button"
export function ButtonSecondary() {
Ghost#
import { Button } from "@/components/ui/button"
export function ButtonGhost() {
Destructive#
import { Button } from "@/components/ui/button"
export function ButtonDestructive() {
Link#
import { Button } from "@/components/ui/button"
export function ButtonLink() {
Icon#
import { CircleFadingArrowUpIcon } from "lucide-react"
import { Button } from "@/components/ui/button"
With Icon#
Remember to add the data-icon="inline-start" or data-icon="inline-end" attribute to the icon for the correct spacing.
import { IconGitBranch, IconGitFork } from "@tabler/icons-react"
import { Button } from "@/components/ui/button"
Rounded#
Use the rounded-full class to make the button rounded.
import { ArrowUpIcon } from "lucide-react"
import { Button } from "@/components/ui/button"Spinner#
Render a <Spinner /> component inside the button to show a loading state. Remember to add the data-icon="inline-start" or data-icon="inline-end" attribute to the spinner for the correct spacing.
import { Button } from "@/components/ui/button"
export function ButtonLoading() {Button Group#
To create a button group, use the ButtonGroup component. See the Button Group documentation for more details.
"use client"
import * as React from "react"
As Link#
You can use the buttonVariants helper to make a link look like a button.
Do not use <Button> for links. The React Aria Button component always applies role="button", which overrides the semantic link role on <a> elements. Use buttonVariants with a plain <a> tag instead.
"use client"
import { buttonVariants } from "@/components/ui/button"
API Reference#
Button#
The Button component is a wrapper around the button element that adds a variety of styles and functionality.
| Prop | Type | Default |
|---|---|---|
variant | "default" | "outline" | "ghost" | "destructive" | "secondary" | "link" | "default" |
size | "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | "default" |
See the React Aria documentation for more information.