iced-cube

Forms

Radio

Picks exactly one option from a small, visible set.

use iced_cube::{radio, radio_group};
use iced_cube::primitives::radio::Direction;
API reference
Default: A vertical group built from an enum's options.Default: A vertical group built from an enum's options.
Static preview
Default. A vertical group built from an enum's options.

Usage

Use radios when there are only a handful of options and seeing them all at once helps the choice. For longer lists, a select takes less room.

Options are usually a small Copy enum with a Display implementation. Clicking a radio or its label emits its value; the app stores it and passes it back as selected.

Examples

Horizontal

The same group laid out in a row.

Horizontal: The same group laid out in a row.Horizontal: The same group laid out in a row.
Static preview

Single radios

Individual radios, one of them disabled.

Single radios: Individual radios, one of them disabled.Single radios: Individual radios, one of them disabled.
Static preview

API

ItemDescription
radio_group(options, selected)Creates one radio per option, labelled with its Display text. It renders disabled until it has a message.
.on_select(f)Sets the message emitted with the option that was clicked.
.direction(Direction)Vertical or Horizontal. Defaults to Vertical. Horizontal groups wrap when space runs out.
radio(label, value, selected)Creates a single radio for building custom layouts. It is selected when selected holds its value.
radio(...).on_select(f)Sets the message for a click, built from the radio's value. Without it the radio is disabled.
Esc