"use client" import * as LabelPrimitive from "@radix-ui/react-label" import React, { ComponentPropsWithoutRef, ElementRef, forwardRef } from "react" import { classNames } from "../../utils" import { Text, TextBodyProps } from "../Text" import { VisuallyHidden } from "../VisuallyHidden" export type LabelProps = ComponentPropsWithoutRef & TextBodyProps & { /** * Renders an asterisk after the label to indicate that the field is required. */ required?: boolean /** * Renders the label visually hidden but still accessible to screen readers. */ visuallyHidden?: boolean } /** * Renders an accessible label associated with controls. */ export const Label = forwardRef< ElementRef, LabelProps >(function Label( { className, size = "md", weight = "semibold", required, visuallyHidden, ...props }, ref, ) { const content = ( ) if (visuallyHidden) { return {content} } return content })