v2
424c17b ยท 1 year ago 26 commits
 1import * as React from "react"
 2import * as LabelPrimitive from "@radix-ui/react-label"
 3import { cva, type VariantProps } from "class-variance-authority"
 4
 5import { cn } from "@/lib/utils"
 6
 7const labelVariants = cva(
 8  "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
 9)
10
11const 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))
22Label.displayName = LabelPrimitive.Root.displayName
23
24export { Label }