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/label第一次使用?先把 registry 加进 components.json。 如何安装
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.
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| 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. |
CLI 会复制进你项目的文件。
正在加载源码