Input
Displays a form input field or a component that looks like an input field.
Input — champ texte HTML natif stylé shadcn. Types HTML supportés (text, email, url, number, password, tel, search, file…) — passer via type.
Toujours accompagné d'un Label pour l'accessibilité (via for/htmlFor).
Installation
$ bext ui add input
Copy and paste the following into src/components/ui/input.tsx.
Usage
Anatomy
<Input type="text|email|number|..." name value placeholder disabled required />
API Reference
Input
| Prop | Type | Default | Description |
|---|---|---|---|
| type | "text" | "email" | "password" | ... | "text" | Type HTML natif. |
| name | string | — | Nom pour form submission. |
| value | string | — | Valeur (contrôlée) ou defaultValue (non-contrôlée). |
| placeholder | string | — | Placeholder muted. |
| disabled | boolean | — | Standard HTML. |
| required | boolean | — | Validation HTML5 native. |
| className | string | — | Défaut : flex h-9 w-full rounded-md border bg-transparent px-3 py-1 text-sm shadow-xs. |
Keyboard
| Key | Action |
|---|---|
| Tab | Focus / défocus. |
| Enter | Submit le form parent (comportement natif). |
Accessibility
Toujours lier un <Label htmlFor="id"> au <Input id="id"> pour que le clic sur le label focus le champ + les AT annoncent le label.
Examples
Disabled
<Input disabled value="Disabled" />
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