label.tsx 734 B

123456789101112131415161718192021222324252627
  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 };