Skip to main content

Module radio_tile

Module radio_tile 

Source
Expand description

RadioTile — a “selectable card” radio option.

A RadioTile behaves as a single radio button (Role::RadioButton, set_toggled) rendered as a bordered, rounded card: a leading icon, a bold title, an inline radio indicator, and a muted, wrapping description. Multiple tiles share a Signal<usize> — selecting one writes its value, which deselects every sibling observing the same signal (the RadioButton model). Group them with RadioTileGroup for layout, roving keyboard navigation, and the AT “N of M” positional announcement.

§Content model

Typed slots cover the common case (matching the reference design): .icon(..), .title(..), .description(..). For arbitrary content, the .body(..) slot replaces the description column with any widget subtree.

§Accessibility

Reports Role::RadioButton with set_toggled mirroring selection, the title as the accessible name, and the description as the accessible description. When grouped, each tile emits push_to_radio_group([sibling_ids]) plus set_position_in_set / set_size_of_set for “N of M”. Inside a RadioTileGroup the tile is not individually focusable — focus roves on the group (WAI-ARIA radiogroup), and the group publishes active_descendant. A standalone tile is focusable and responds to Space / Action::Click.

let selected = ctx.signal(0_usize);
RadioTileGroup::new(selected)
    .tile(RadioTile::new().icon(icon).title(tr!(single_file())).description(tr!(single_file_desc())))
    .tile(RadioTile::new().icon(icon2).title(tr!(bundle())).description(tr!(bundle_desc())))

Structs§

RadioTile
A single selectable-card radio option. See the module docs.

Enums§

RadioTileIndicatorSide
Which side of the top row the radio indicator sits on. Defaults to Trailing (top-right in LTR), matching the reference design.