Components
- 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
- Hover Card
- Input
- Input OTP
- 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
import { Button } from "@/components/button/button";
export function ButtonDemo() {
return <Button>Button</Button>;
}Installation
$ pnpm dlx shadcn@latest add https://shadcn-cssinjs.vercel.app/r/button.json
Usage
import { Button } from "@/components/ui/button/button";<Button variant="outline">Button</Button>Examples
Variants
Use the variant prop to change the button style.
import { Button } from "@/components/button/button";
export function ButtonVariants() {
return (
<div style={{ display: "flex", flexWrap: "wrap", gap: 8 }}>
<Button>Default</Button>Size
Use the size prop to change the button size.
import { Button } from "@/components/button/button";
export function ButtonSizes() {
return (
<div style={{ alignItems: "center", display: "flex", gap: 8 }}>
<Button size="sm">Small</Button>Link
import { Button } from "@/components/button/button";
export function ButtonLink() {
return <Button variant="link">Link</Button>;
}Icon
Use size="icon" for a square, icon-only button.
import { ChevronRightIcon } from "lucide-react";
import { Button } from "@/components/button/button";
export function ButtonIcon() {
return (With Icon
Place an icon before or after the label.
import { MailIcon } from "lucide-react";
import { Button } from "@/components/button/button";
export function ButtonWithIcon() {
return (Disabled
import { Loader2Icon } from "lucide-react";
import { Button } from "@/components/button/button";
export function ButtonDisabled() {
return (RTL
To enable right-to-left support, see the RTL 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" | "destructive" | "outline" | "secondary" | "ghost" | "link" | "default" |
size | "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg" | "default" |
render | React.ReactElement | - |
Use the render prop to render the button as a different element (the Base UI equivalent of asChild).