tasko/components/ui/label.tsx

27 lines
733 B
TypeScript
Raw Normal View History

2024-02-16 01:49:19 +00:00
'use client';
2024-02-15 02:30:10 +00:00
2024-02-16 01:49:19 +00:00
import * as React from 'react';
import * as LabelPrimitive from '@radix-ui/react-label';
import { cva, type VariantProps } from 'class-variance-authority';
2024-02-15 02:30:10 +00:00
2024-02-16 01:49:19 +00:00
import { cn } from '@/lib/utils';
2024-02-15 02:30:10 +00:00
const labelVariants = cva(
2024-02-16 01:49:19 +00:00
'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70'
);
2024-02-15 02:30:10 +00:00
const Label = React.forwardRef<
React.ElementRef<typeof LabelPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
VariantProps<typeof labelVariants>
>(({ className, ...props }, ref) => (
<LabelPrimitive.Root
ref={ref}
className={cn(labelVariants(), className)}
{...props}
/>
2024-02-16 01:49:19 +00:00
));
Label.displayName = LabelPrimitive.Root.displayName;
2024-02-15 02:30:10 +00:00
2024-02-16 01:49:19 +00:00
export { Label };