label.tsx 732 B

1234567891011121314151617181920212223
  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. import { cn } from '@/lib/utils'
  5. const labelVariants = cva(
  6. 'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70'
  7. )
  8. const Label = React.forwardRef<
  9. React.ElementRef<typeof LabelPrimitive.Root>,
  10. React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
  11. VariantProps<typeof labelVariants>
  12. >(({ className, ...props }, ref) => (
  13. <LabelPrimitive.Root
  14. ref={ref}
  15. className={cn(labelVariants(), className)}
  16. {...props}
  17. />
  18. ))
  19. Label.displayName = LabelPrimitive.Root.displayName
  20. export { Label }