bx

Label

Renders an accessible label associated with controls.

tsx
<Label htmlFor="name">Your name</Label>
<Input id="name" placeholder="Sofia Davis" />

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

Terminal
$ bext ui add label

Usage

tsx
import { Label, Input } from "@bext-stack/ui/primitives"

<div className="grid gap-2">
  <Label htmlFor="username">Username</Label>
  <Input id="username" />
</div>

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.

Try it live Open in play

Edit this example live in the bext playground — it compiles and runs entirely in your browser.

src/app/page.tsx 1 file · react · runs in your browser
The React idiom — same UI, for comparison.