label.tsx 724 B

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