Pick exactly one of a small set — post visibility, invoice type, a plan. Classic radios with descriptions, selectable cards, or a compact segmented control. One tab stop, arrow keys move and select.
Installation
The whole kit as one package — get updates by bumping the version. Add the styles to globals.css: @import "@vamos-ui/react/styles.css";
Usage
import { Field, RadioGroup } from "@vamos-ui/react";
<Field label="Visibility">
<RadioGroup
name="visibility"
defaultValue="public"
items={[
{ value: "public", label: "Public" },
{ value: "private", label: "Private" },
]}
/>
</Field>Inside a Field the group is labelled by the Field label (aria-labelledby) and described by its hint or error.
Rule of thumb: a value you submit → RadioGroup (segmented if labels are short); a view you switch → ToggleGroup.
Examples
Plan cards
variant="card" with icon, description and free content (price, badge) as children of RadioGroupItem.
Prices exclude VAT. Switch or cancel any time.
Segmented
For short labels that are a form value. For view or toolbar state use ToggleGroup (see Button Group).
For larger groups, call the restaurant.
Conditional fields
Controlled value drives which fields follow — a typical checkout / invoice form.
Sizes & states
Small size, a disabled option, the Field error state and read-only.
Choose a shipping method to continue.
Locked after the order was packed.
API
RadioGroup
| Prop | Type | Default |
|---|---|---|
valueControlled value; null = nothing selected. | V | null | — |
defaultValueInitial value (uncontrolled). | V | null | null |
onValueChangeCalled when the selection changes. | (value: V) => void | — |
itemsShorthand; or compose RadioGroupItem children. | { value, label, description?, icon?, disabled? }[] | — |
variantCircles, selectable tiles, or a segmented control. | "default" | "card" | "segmented" | "default" |
orientationLayout and arrow-key axis. | "vertical" | "horizontal" | vertical (segmented: horizontal) |
size16 / 18 px circles; segment height from --control-h. | "sm" | "md" | "md" |
nameForm name (hidden input). Inherited from Field. | string | — |
invalid / readOnly / required / disabledGroup state; inherited from Field. | boolean | — |
loopArrow keys wrap around. | boolean | true |
RadioGroupItem
| Prop | Type | Default |
|---|---|---|
valueRequired. | string | — |
labelNames the radio (aria-labelledby). | ReactNode | — |
descriptionLinked with aria-describedby. | ReactNode | — |
iconLeading icon (card, segmented). | ReactNode | — |
childrenExtra card content (price, badge) under the label. | ReactNode | — |
disabledSkipped by arrow keys. | boolean | — |
controlClassNameClasses for the circle (default variant). | string | — |