Default
Click the words and the field takes focus.
The words that go with a field, in the bold hand font, with an optional red pencil star for required fields. It fades with a disabled control and hands its click to it.
npx shadcn@latest add @wobko/labelFirst time here? Add the registry to components.json first. How to install
Click the words and the field takes focus.
The star is drawn, not typed, and it is decorative: required on the control is what a screen reader hears.
A label after a peer control fades to graphite when the control is disabled: checkbox as a peer, a drawn Input marked peer, or a group with data-disabled.
shadcn's `label-demo`: a Label next to a Checkbox, joined by `htmlFor` and `id`. Click the words and the box ticks itself; the row is the hit area.
Radix Label.Root (a real <label>). htmlFor or nesting associate it with a control; double-clicking its text does not select it. required draws a star after the text.
| Prop | Type | Default | Description |
|---|---|---|---|
| required | boolean | false | A red-pencil star after the text: three crossing strokes, drawn once per label. It is decorative (aria-hidden) and adds nothing to the accessible name: put required on the control so it is announced. |
| seed | string | number | - | Pins the hand of the star. Default: derived from useId(). |
| htmlFor | string | - | The id of the control. |
The files the CLI copies into your project.
Loading the source