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