ComponentsForm
Label
An accessible label for form controls. Built on Radix UI.
Default
With Checkbox
Required Indicator
Installation
npx visor add labelThis copies two files into your project:
components/ui/label/label.tsx— the componentcomponents/ui/label/label.module.css— the styles
Usage
import { Label } from '@/components/ui/label/label';
<Label htmlFor="email">Email</Label>API Reference
LabelProps
| Prop | Type | Default | Description |
|---|---|---|---|
htmlFor | string | — | The ID of the form element this label is associated with. |
className | string | — | Additional CSS class names to merge onto the element. |
...props | React.LabelHTMLAttributes<HTMLLabelElement> | — | All standard HTML label attributes are forwarded. |
The component also accepts all standard <label> HTML attributes.
Accessibility
- Built on
@radix-ui/react-label— renders a native<label>element - Always use
htmlFormatching the associated control'sidfor proper screen reader association - Clicking the label focuses or activates the associated control (standard browser behavior)
- For required field indicators, use
aria-hidden="true"on the visual asterisk and addrequiredoraria-required="true"on the input itself