Radio Group
A set of checkable buttons where no more than one can be checked at a time.
RadioGroup — sélection exclusive parmi 2+ options (payment method, tier, orientation). Sémantiquement différent d'un Select — Radio quand toutes les options sont visibles en même temps.
Installation
$ bext ui add radio-group
Copy and paste the following into src/components/ui/radio-group.tsx.
This component is interactive — make sure the shared island is loaded (see Islands). It reacts to data-ui="radio-group" hooks.
Usage
Anatomy
<RadioGroup name value> ├── <RadioGroupItem value="a" id="r-a" /> ├── <RadioGroupItem value="b" id="r-b" /> └── <RadioGroupItem value="c" id="r-c" />
API Reference
RadioGroup
| Prop | Type | Default | Description |
|---|---|---|---|
| name | string | — | Nom form (partagé par tous les items). |
| value | string | — | Value initialement sélectionnée. |
RadioGroupItem
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | — | undefined |
| id | string | — | Pour lier au Label. |
Data Attributes
Attributs qu'on peut cibler en CSS custom pour override le style par état.
| Attribute | On | Values | Description |
|---|---|---|---|
| data-ui="radio-group" | root | — | L'island route les clics aux items. |
| data-state | item | "checked" | "unchecked" | État par item. |
Keyboard
| Key | Action |
|---|---|
| Arrow keys | Naviguer entre items (comportement natif si role=radio). |
| Space | Sélectionner. |
Accessibility
RadioGroup porte role="radiogroup", items role="radio". Toujours accompagner chaque item d'un Label.
Edit this component live in the bext playground. The PRISM + signals version is the bext-native idiom — fine-grained reactivity, no virtual DOM.
On This Page