forms
Label
Renders an accessible label associated with controls. Built with Base UI and Tailwind CSS. Copy-paste ready.
Installation
Usage
Anatomy
Good to know
- Link a label to its control with
htmlForand a matchingid, or wrap the control:<Label><Checkbox /> Remember me</Label>. - Inside a
Field, useFieldLabelinstead. It links to the control automatically. - Use the
renderprop to render a different element with label styling, e.g.render={<span />}for a visual-only label.
API Reference
Label
Styled <label> element. Accepts all standard <label> HTML attributes.
Examples
With Checkbox
Wraps a Checkbox and its label text inside Label so clicking the label text also toggles the checkbox.
With Textarea
Associates a Label with a Textarea for accessible multi-line text input labelling.
With Required
Appends a red asterisk to the label text to signal that the associated field must be filled.
With Optional
Appends an "(Optional)" or similar tag to distinguish non-required fields from mandatory ones.
With Info Tooltip
Adds a small info icon button next to the label text that opens a Tooltip with additional context on hover or focus.
With Badge
Appends an inline Badge (e.g. "New", "Beta", "Pro") to the label to communicate feature availability or access tier.
With Counter
Shows a live character count inline with the label that updates as the user types into the associated input or textarea.
With Helper Text
Places a short description paragraph below the label to provide additional guidance about what to enter.
With Status Dot
A colored dot prepended to the label text to indicate the current status of the associated field or resource.
With Keyboard Shortcut
An inline Kbd badge aligned to the trailing edge of the label shows the keyboard shortcut that focuses or activates the field.
With Inline Link
A secondary action link (e.g. "Forgot password?") placed inline at the label's trailing edge — common for password fields.
With Icon Prefix
A small icon placed before the label text to visually reinforce the field's purpose at a glance.
Horizontal Layout
Labels right-aligned in a fixed-width column with inputs filling the remaining space — suitable for compact settings or profile forms.
With Error State
A controlled email field where a validation error shows an aria-invalid border and an inline FieldDescription error message below the label.