- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Collapsible
- Combobox
- Command
- Context Menu
- Data Table
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- Menubar
- Native Select
- Navigation Menu
- Pagination
- Popover
- Progress
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toggle
- Toggle Group
- Tooltip
- Typography
import { ArrowUpIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
export function ButtonDemo() {
return (Installation
$ pnpm dlx shadcn@latest add https://shadcn-cssinjs.com/r/button.json
Usage
import { Button } from "@/components/ui/button";<Button variant="outline">Button</Button>Size
Use the size prop to change the size of the button.
import { ArrowUpRightIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
export function ButtonSize() {
return (Default
import { Button } from "@/components/ui/button";
export function ButtonDefault() {
return <Button>Button</Button>;
}Outline
import { Button } from "@/components/ui/button";
export function ButtonOutline() {
return <Button variant="outline">Outline</Button>;
}Secondary
import { Button } from "@/components/ui/button";
export function ButtonSecondary() {
return <Button variant="secondary">Secondary</Button>;
}Ghost
import { Button } from "@/components/ui/button";
export function ButtonGhost() {
return <Button variant="ghost">Ghost</Button>;
}Destructive
import { Button } from "@/components/ui/button";
export function ButtonDestructive() {
return <Button variant="destructive">Destructive</Button>;
}Link
import { Button } from "@/components/ui/button";
export function ButtonLink() {
return <Button variant="link">Link</Button>;
}Icon
import { CircleFadingArrowUpIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
export function ButtonIcon() {
return (With Icon
Remember to add the data-icon="inline-start" or data-icon="inline-end" attribute to the icon for the correct spacing.
import { GitBranchIcon, GitForkIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
export function ButtonWithIcon() {
return (Rounded
Use the className prop to make the button rounded.
import { ArrowUpIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
export function ButtonRounded() {
return (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";
import { Spinner } from "@/components/ui/spinner";
export function ButtonLoading() {
return (
<div className="flex gap-2">Button Group
To create a button group, use the ButtonGroup component. See the Button Group documentation for more details.
"use client";
import {
ArchiveIcon,
ArrowLeftIcon,
CalendarPlusIcon,As Link
You can use the buttonVariants helper to make a link look like a button.
Do not use <Button render={<a />} nativeButton={false} /> for links. The Base UI Button component always applies role="button", which overrides the semantic link role on <a> elements. Use buttonVariants with a plain <a> tag instead.
import { Button } from "@/components/ui/button";
export function ButtonRender() {
return (
<Button size="sm" variant="secondary" render={<a href="/docs" aria-label="Login">Login</a>} />
);RTL
To enable RTL support in shadcn/ui, see the RTL configuration guide.
"use client";
import { ArrowRightIcon, PlusIcon } from "lucide-react";
import { useTranslation } from "@/components/language-selector";
import type { Translations } from "@/components/language-selector";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" |