label.tsx raw
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> & VariantProps<typeof labelVariants>
14 >(({ className, ...props }, ref) => (
15 <LabelPrimitive.Root ref={ref} className={cn(labelVariants(), className)} {...props} />
16 ))
17 Label.displayName = LabelPrimitive.Root.displayName
18
19 export { Label }
20