Skip to content
SENVENLI UI

Radio group

One choice from a few options that all stay visible.
Options as data
import { RadioGroup, Radio } from "@senvenli/react/selection";

Examples

With descriptions

Radio children, each with a line of detail; one is unavailable.

Horizontal

Short options on one line; they wrap when space runs out.

Cards

`variant="card"`: each option a card, its content yours (a name, a Badge, a price).

Time slots

Cards as a time picker; a taken time stays visible, disabled, with its reason.

Guidelines

When to use it

  • One choice from 2 to 5 options people should compare.

Use something else when

  • There are many options. Select
  • Options need icons or descriptions, or several may be picked, in a visible list. List box

Do and avoid

  • Use variant="card" when each option needs a line of detail (a plan, a delivery option, a time slot); its content is yours.

Accessibility

Keyboard

KeysWhat happens
Arrow keysMoves and selects within the group.

Built in

  • One tab stop for the group.
  • Required fields show "Fill in this field." after a blur or a submit; your own errorMessage replaces it.

You provide

  • A label for the group.

API reference

RadioGroup

size
ComponentSize

The size of every Radio in the group.

labelRequired
React.ReactNode

The group legend, required.

items
readonly RadioItem[]

The options as data, or Radio children.

children
React.ReactNode
description
React.ReactNode
errorMessage
React.ReactNode
requiredValidation
RequiredValidation

Who says a required group with no option chosen is missing: field (default) shows "Fill in this field." when focus leaves the group and on a DS Form submit, which it then blocks; app only marks the group. See {@link RequiredValidation}. The app's isInvalid (true with its errorMessage, or false) overrides the check, as on TextField. Disabled, empty and required, it still blocks a DS Form's submit and cannot take focus (as TextField).

variant
RadioGroupVariantDefault "default"

default: rows with a dot. card: each option a card in a grid of equal columns (no narrower than 180px), for choices that need a line of detail each (a plan, a delivery option, a time slot).

Also takes 79 standard DOM and ARIA attributes (id, aria-label, event handlers…).

Radio

valueRequired
string
size
ComponentSize

small, medium (default) or large; a group's size, then the provider default, otherwise.

childrenRequired
React.ReactNode
description
React.ReactNode
isDisabled
boolean