'use client'; import * as React from 'react'; import * as LabelPrimitive from '@radix-ui/react-label'; import { cn } from '../../shared/utils'; /** * Accessible form field label. * * @description * Styled label with built-in support for error and disabled peer states. * Renders as a Radix UI label for full accessibility semantics. * Supports the standard size scale (`sm`, `md`, `lg`) for consistent form alignment. * * @ai-rules * 1. Always associate with the input using matching `htmlFor` and `id` props. * 2. Inside a `
`, prefer `` — it auto-connects to the field via context. * 3. Use the `size` prop to match the corresponding Input/Select size. */ function Label({ className, size = 'md', ...props }: React.ComponentProps & { /** * Size variant — matches the form component sizing scale. * - `sm`: text-xs * - `md`: text-sm — **default** * - `lg`: text-base */ size?: 'sm' | 'md' | 'lg'; }) { const sizeClasses = { sm: 'text-xs', md: 'text-sm', lg: 'text-base', }; return ( ); } export { Label };