// components/registry/n2-primitives/example.tsx
"use client"
// 1. Variants with CVA
const exampleVariants = cva(
"inline-flex items-center justify-center rounded-lg font-medium transition-colors",
{
variants: {
variant: {
default: "bg-primary text-primary-foreground hover:bg-primary/80",
outline: "border border-border bg-input/30 hover:bg-input/50",
ghost: "hover:bg-muted hover:text-foreground",
},
size: {
default: "h-14 px-5 text-sm",
sm: "h-12 px-4 text-xs",
},
},
defaultVariants: { variant: "default", size: "default" },
}
)
// 2. Props extend the CVA variants and the HTML element
interface ExampleProps
extends React.ComponentProps<"div">,
VariantProps<typeof exampleVariants> {
asChild?: boolean
}
// 3. Named export, never default
// 4. Export the variants too, for composition elsewhere
export { exampleVariants }