'use client'; import * as React from 'react'; import * as LabelPrimitive from '@radix-ui/react-label'; import { Slot } from '@radix-ui/react-slot'; import { cva, type VariantProps } from 'class-variance-authority'; import { cn } from '@/lib/utils'; /** * 标准 shadcn/ui Label 组件 * 基于 @radix-ui/react-label */ const labelVariants = cva( 'flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50' ); function Label({ className, asChild, ...props }: React.ComponentProps & VariantProps & { asChild?: boolean }) { const Comp = asChild ? Slot : LabelPrimitive.Root; return ( ); } export { Label, labelVariants };