Radio group
One choice among a few options, all visible: dots with their words, whole cards, tactile keys that press in, or a segmented control.
- Domaine
- Formulaires
- Niveau de support
- Taille
- 4.4 kB gzip, budget 12.7 kB
- Qui l'utilise
- 9 fichiers des produits et sites en production l'importent (Verikora : 5, Sovkora : 4) Compté dans l'inventaire daté du 2026-11-23.
import { RadioGroup } from "@krizaka/ui/radio-group";Web et mobile — le même composant pour React et React Native. Bêta : son API peut encore changer à une version mineure.
Pourquoi il est là. Used by Sovkora, Verikora.
Quand l’utiliser
- In a form, to choose exactly one of two to five options that should all be seen: a frequency, a quality.
RadioGroup.Cardwhen each option needs more than a line: an amount, a plan, a payment method.RadioGroup.Button(variant="buttons") for short, tactile choices made in a tap: a size, a tip, a level.RadioGroup.Segment(variant="segmented") for two to four short choices of a form on one line: a billing period, a unit.
Quand ne pas l’utiliser
Installation
Installer
npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcssStyles
@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";Importer
import { RadioGroup } from "@krizaka/ui/radio-group";Exemples
Items
Dots and their words, one disabled.
Cards
Whole cards: the chosen one carries the accent.
Horizontal
orientation="horizontal": the items in a row.
Tactile keys
variant="buttons": keys raised on their ledge, pressed in while held — the chosen one stays sunk.
Segmented
variant="segmented": one light glides to the chosen segment.
Props
RadioGroupRoot
value/defaultValue + onValueChange, orientation, required, name for a form, variant for the layout.
| Prop | Type | Défaut | Description |
|---|---|---|---|
invalid | boolean | — | Marks every radio invalid: aria-invalid (pair it with a Field.Error). |
label | string | — | The group's accessible name — passed translated (or aria-labelledby a visible heading). |
onValueChange | (((value: string) => void) & ((id: string) => void)) | — | The viewer chooses another picture. |
routeKey | string | — | Binds the choice to this search parameter of the URL (?kind=…): the URL is the state — for a view's selection (a segmented switch), not a form field. |
routeValues | readonly string[] | — | The values the parameter may hold (the radios' values); the first is the default unless defaultValue says otherwise. |
value | string | — | The chosen id (controlled). |
variant | "list" | "buttons" | "cards" | "segmented" | list | The layout of the radios: list (dots), cards (a grid of Cards), buttons (a row of tactile Buttons), or
segmented (a track of Segments, one light gliding to the choice). |
RadioGroupItem
A radio: a dot, and its words when given.
| Prop | Type | Défaut | Description |
|---|---|---|---|
children | ReactNode | — | The words next to the dot, clickable. Otherwise name it with Field.Label htmlFor or aria-label. |
value | string | — | The chosen id (controlled). |
RadioGroupCard
A whole card as the radio: its content is the radio's name; its check lights up when chosen.
| Prop | Type | Défaut | Description |
|---|---|---|---|
value | string | — | The chosen id (controlled). |
RadioGroupButton
A tactile key: raised on its ledge, pressed in while held and once chosen — sizes, a tip, a level.
| Prop | Type | Défaut | Description |
|---|---|---|---|
hint | ReactNode | — | A second line under the words ("+15 %"), part of the radio's name. |
value | string | — | The chosen id (controlled). |
RadioGroupSegment
A segment of a variant="segmented" group: equal widths, one light gliding to the choice.
| Prop | Type | Défaut | Description |
|---|---|---|---|
value | string | — | The chosen id (controlled). |
Accessibilité
- Radix RadioGroup:
role="radiogroup"named bylabel,role="radio"witharia-checkedon each option. - Disabled options are skipped by the arrows.
- A tactile key’s
hintis part of its name; the pressed look follows the checked state, never colour alone (it sinks).
Clavier
| Touches | Action |
|---|---|
| Tab | Moves into the group (one tab stop, on the chosen option) and out of it. |
| Arrow keys | Move to the next or previous option and choose it. |
Bonnes pratiques
- Give the group a
label: the question being answered. - Pre-select the safest or most common option with
defaultValuewhen there is one. - Keep the labels parallel and short.
Composants liés
Générée depuis le code de @krizaka/ui 5.3.4 : son meta.ts, ses exemples et ses types.Modifier cette documentation sur GitHub