Skip to content
Glint UI

RadioGroup

A set of options where exactly one is chosen, walked with the arrow keys.

Usage

import { RadioGroup, RadioItem } from "@glint/components/radio-group.slint";
export component AppWindow inherits Window {
in-out property <int> billing-cycle: 0;
VerticalLayout {
alignment: center;
RadioGroup {
selected <=> root.billing-cycle;
items: [
{ value: "monthly", label: "Monthly billing" },
{ value: "yearly", label: "Yearly billing (Save 20%)" },
];
changed(index) => {
// handle choice
}
}
}
}

RadioGroup presents a mutually exclusive single-selection set. Keyboard navigation uses arrow keys to cycle through options, committing the selection immediately.

Examples

Orientations

The orientation property controls the layout direction of items:

  • RadioOrientation.vertical: Stacks options in a column (default).
  • RadioOrientation.horizontal: Places options side by side in a row.

Descriptions and disabled options

Each item can declare a secondary description and individual disabled state. Arrow keys skip disabled options automatically.

Custom Radio composition

For complex layouts (such as rich selectable cards), compose individual Radio components by binding their checked and clicked handlers to shared state.

API Reference

Properties

PropertyTypeDefaultDescription
itemsin [RadioItem]no defaultOptions shown in the group.
selectedin-out int0Two-way; index of the chosen item.
disabledin boolfalseWhen true, the whole group dims and stops responding. An option may also refuse on its own; see RadioItem.disabled.
invalidin boolfalseWhen true, the options wear the destructive border and the group announces itself invalid. The message that explains the error belongs to the surrounding Field — bind this to that Field's invalid.
orientationin RadioOrientationRadioOrientation.verticalvertical (default) or horizontal.

Callbacks

CallbackDescription
changed(int)Fired with the new selected index.

Enums

EnumValues
RadioOrientationvertical, horizontal

Radio

Individual radio button primitive used inside RadioGroup or for custom choice cards.

Properties

PropertyTypeDefaultDescription
labelin stringno defaultLabel text rendered next to the circle. Also the option's accessible name.
descriptionin stringno defaultSecond line under the label, in the label's own column.
checkedin boolfalseWhether this option is the chosen one. Bound, never written here.
disabledin boolfalseWhen true, the option dims and stops responding.
invalidin boolfalseWhen true, the circle wears the destructive border. Only the border: an option is a row of a group, never the control a Field binds, so the group is what announces the error — saying it here too would repeat it on every option a user arrows past. CONTEXT.md "Field": controls carry only visual error state.
show-focusin boolfalseWhen true, the focus ring renders — the set draws it on the option the keyboard stands on, since the set is what owns the keyboard.
indexin int0Position in the set, announced as the option's index.

Callbacks

CallbackDescription
clicked()Fired when this option is activated — by the pointer or by assistive technology. The set is what turns that into a selection.

Accessibility

  • Radio group role. RadioGroup publishes accessible-role: radio-group containing child radio-button items.
  • Focus delegation. accessible-delegate-focus routes assistive technology announcements to the currently selected item.
  • Keyboard navigation. / and / cycle through options with wrap-around, stepping over disabled options.
  • invalid announces the word “Invalid”. Set on the group, it rides the description channel ADR-0013 opened because Slint 1.17 publishes no accessible-invalid. In the current implementation, the group’s accessible-description is only "Invalid"; it is not appended to another description. A red border is not the announcement.