Label.tsx (723B)
1 "use client" 2 3 import * as React from "react" 4 import * as LabelPrimitive from "@radix-ui/react-label" 5 import { cva, type VariantProps } from "class-variance-authority" 6 7 import { cn } from "@/lib/utils" 8 9 const labelVariants = cva( 10 "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" 11 ) 12 13 const Label = React.forwardRef< 14 React.ElementRef<typeof LabelPrimitive.Root>, 15 React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> & 16 VariantProps<typeof labelVariants> 17 >(({ className, ...props }, ref) => ( 18 <LabelPrimitive.Root 19 ref={ref} 20 className={cn(labelVariants(), className)} 21 {...props} 22 /> 23 )) 24 Label.displayName = LabelPrimitive.Root.displayName 25 26 export { Label } 27