VisorVisor
ComponentsForm

Label

An accessible label for form controls. Built on Radix UI.

Default

With Checkbox

Required Indicator

Installation

npx visor add label

This copies two files into your project:

  • components/ui/label/label.tsx — the component
  • components/ui/label/label.module.css — the styles

Usage

import { Label } from '@/components/ui/label/label';

<Label htmlFor="email">Email</Label>

API Reference

LabelProps

PropTypeDefaultDescription
htmlForstringThe ID of the form element this label is associated with.
classNamestringAdditional CSS class names to merge onto the element.
...propsReact.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 htmlFor matching the associated control's id for 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 add required or aria-required="true" on the input itself