Button
sidcn/buttonFreeComponent
A beautiful button component
Live preview
live · rendered by the registry
Rendered by sidcn on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://ui.siddhesh.cc/r/button.jsonSource
1import { Slot } from "@radix-ui/react-slot";2import { cva, type VariantProps } from "class-variance-authority";3import type * as React from "react";45import { cn } from "@/lib/utils";67const buttonVariants = cva(8 "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 text-sm font-medium focus-visible:ring-[3px] aria-invalid:ring-[3px] [&_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 hover:cursor-pointer",9 {10 variants: {11 variant: {12 default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",13 success:14 "bg-success text-white shadow-xs hover:bg-success/90 focus-visible:ring-success/20 dark:focus-visible:ring-success/40 dark:bg-success/60",15 destructive:16 "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",17 warning:18 "bg-warning dark:bg-warning/70 text-white shadow-xs hover:bg-warning/90 focus-visible:ring-warning/20",19 outline:20 "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",21 secondary:22 "bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",23 ghost:24 "hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground",25 link: "text-primary underline-offset-4 hover:underline",26 subtle: "bg-muted/50 text-muted-foreground hover:bg-muted",27 glass:28 "bg-foreground/10 text-primary shadow-xs backdrop-blur-sm border border-foreground/10 hover:bg-foreground/20",29 },30 size: {31 default:32 "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",33// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from sidcn
All 14 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Badgebadge | sidcn | Components | Free | 3 deps | |
| Data Tabledata-table | sidcn | Components | Free | 2 deps | |
| Date Inputdate-input | sidcn | Components | Free | 1 dep | |
| Date Time Inputdate-time-input | sidcn | Components | Free | 2 deps | |
| Iconsicons | sidcn | Components | Free | no deps | |
| Package Manager Commandpackage-manager-command | sidcn | Components | Free | no deps | |
| Sidebarsidebar | sidcn | Components | Free | 3 deps | |
| Sonnersonner | sidcn | Components | Free | 2 deps |
