Skip to content
Ballpoint

Label

A label in the hand, that dims with the control it names.

From shadcn/ui

Installation

pnpm dlx shadcn@latest add @ballpoint/label

Usage

tsx
import { Label } from "@/components/ui/label"

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

Examples

With controls

Wrap a switch, radio or checkbox so the whole row is clickable; mark required fields; disabled controls dim their label.

Required and optional

A red-pen asterisk for required fields, a quiet note for optional ones.

API reference

htmlFor
string

The id of the control it names. Or wrap the control instead: the label lays it out beside the text.

className
string

A plain <label>: every prop goes to it.

required
default false
boolean

Marks the label with a red-pen asterisk. The control still needs its own required.

optional
default false
boolean

Writes (optional) after the label, in lighter ink.