Button
uiable/buttonFreeComponent
Button component.
Live preview
live · rendered by the registry
Rendered by uiable on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://uiable.com/r/button.jsonSource
1"use client";23import { Button as ButtonPrimitive } from "@base-ui/react/button";4import { cva, type VariantProps } from "class-variance-authority";56import { cn } from "@/lib/utils";78const buttonVariants = cva(9 "focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-lg border border-transparent bg-clip-padding font-medium focus-visible:ring-3 aria-invalid:ring-3 [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none",10 {11 variants: {12 variant: {13 default:14 "bg-primary text-white hover:bg-primary-600 [a]:hover:bg-primary-600",15 outline:16 "border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground",17 secondary:18 "bg-secondary text-secondary-foreground hover:bg-secondary/80",19 ghost:20 "hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground",21 destructive:22 "bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30",23 link: "text-primary underline-offset-4 hover:underline"24 },25 size: {26 default:27 "py-2 px-4 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",28 xs: "h-6 gap-1 px-2 text-xs has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",29 sm: "py-1 px-3 px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",30 lg: "py-3 px-5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",31 icon: "size-8",32 "icon-xs": "size-6 [&_svg:not([class*='size-'])]:size-3",33 "icon-sm": "size-7",34 "icon-lg": "size-9"35 }36 },37 defaultVariants: {38 variant: "default",39 size: "default"40 }41 }42);4344function Button({45// … truncated
What it pulls in
npm packages
Files it writes
More from uiable
All 712 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | uiable | Components | Free | 2 deps | |
| Alertalert | uiable | Components | Free | 1 dep | |
| Alert Dialogalert-dialog | uiable | Components | Free | 1 dep | |
| Aspect Ratioaspect-ratio | uiable | Components | Free | no deps | |
| Attachmentattachment | uiable | Components | Free | 2 deps | |
| Avataravatar | uiable | Components | Free | 1 dep | |
| Badgebadge | uiable | Components | Free | 2 deps | |
| Breadcrumbbreadcrumb | uiable | Components | Free | 2 deps |
