Label
Renders an accessible label associated with controls.
Label — <label> HTML natif stylé. Prop for (ou htmlFor) obligatoire pour lier au champ (Input, Checkbox, RadioGroup…).
Le clic sur le label focus/toggle le champ associé — comportement natif HTML.
Installation
$ bext ui add label
Copy and paste the following into src/components/ui/label.tsx.
Usage
Anatomy
<Label for="input-id">Label text</Label>
API Reference
Label
| Prop | Type | Default | Description |
|---|---|---|---|
| for | string | — | id du champ associé. Peut aussi être écrit htmlFor. |
| className | string | — | text-sm font-medium leading-none par défaut. |
Accessibility
Cliquer sur un Label lié focus l'Input, coche/décoche le Checkbox, etc. — comportement HTML natif.
Ne jamais mettre un placeholder à la place d'un label — les AT ne l'annoncent pas correctement.
Edit this example live in the bext playground — it compiles and runs entirely in your browser.
The React idiom — same UI, for comparison.
On This Page