mirror of
https://github.com/hanzoai/shadcn.git
synced 2026-10-30 18:22:59 +00:00
Upstream sync from shadcn-ui/ui (1686 commits since last merge base). Key changes: - packages/shadcn upgraded to 4.1.0 (CLI font transformers, scaffold from github, chart colors) - apps/v4 replaces apps/www as the primary docs/registry app - Font system: 25+ heading font registries, font markers utility, @supports override - Chart improvements: recharts v3 compat, radial chart fixes - templates/ updated with monorepo variants (astro, vite, react-router, start) - skills/shadcn AI skill definitions added - deprecated/ removed (auth, auth-firebase, cli, www) Preserved Hanzo-only paths: app/, pkg/, demo/, docs/, template/next/
54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
"use client"
|
|
|
|
import { Button as ButtonPrimitive } from "@base-ui/react/button"
|
|
import { cva, type VariantProps } from "class-variance-authority"
|
|
|
|
import { cn } from "@/registry/bases/base/lib/utils"
|
|
|
|
const buttonVariants = cva(
|
|
"cn-button group/button inline-flex shrink-0 items-center justify-center whitespace-nowrap transition-all outline-none select-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
{
|
|
variants: {
|
|
variant: {
|
|
default: "cn-button-variant-default",
|
|
outline: "cn-button-variant-outline",
|
|
secondary: "cn-button-variant-secondary",
|
|
ghost: "cn-button-variant-ghost",
|
|
destructive: "cn-button-variant-destructive",
|
|
link: "cn-button-variant-link",
|
|
},
|
|
size: {
|
|
default: "cn-button-size-default",
|
|
xs: "cn-button-size-xs",
|
|
sm: "cn-button-size-sm",
|
|
lg: "cn-button-size-lg",
|
|
icon: "cn-button-size-icon",
|
|
"icon-xs": "cn-button-size-icon-xs",
|
|
"icon-sm": "cn-button-size-icon-sm",
|
|
"icon-lg": "cn-button-size-icon-lg",
|
|
},
|
|
},
|
|
defaultVariants: {
|
|
variant: "default",
|
|
size: "default",
|
|
},
|
|
}
|
|
)
|
|
|
|
function Button({
|
|
className,
|
|
variant = "default",
|
|
size = "default",
|
|
...props
|
|
}: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>) {
|
|
return (
|
|
<ButtonPrimitive
|
|
data-slot="button"
|
|
className={cn(buttonVariants({ variant, size, className }))}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export { Button, buttonVariants }
|