label.tsx (679B)
1 "use client" 2 3 import { Root } from "@radix-ui/react-label" 4 import { cva, type VariantProps } from "class-variance-authority" 5 6 import { cn } from "@/lib/utils" 7 import { forwardRef, ComponentRef, ComponentPropsWithoutRef } from "react" 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 = forwardRef< 14 ComponentRef<typeof Root>, 15 ComponentPropsWithoutRef<typeof Root> & 16 VariantProps<typeof labelVariants> 17 >(({ className, ...props }, ref) => ( 18 <Root 19 ref={ref} 20 className={cn(labelVariants(), className)} 21 {...props} 22 /> 23 )) 24 Label.displayName = Root.displayName 25 26 export { Label }