Skip to main content

Module toggle_group

Module toggle_group 

Source
Available on crate feature toggle-group only.
Expand description

A row of toggles where one, or several, can be on.

State owns the items and the selection. In Mode::Single pressing an item turns the others off, like a segmented control; in Mode::Multiple each item switches on and off by itself, like the formatting buttons of a text editor. Disabled items are skipped.

Keyboard shortcuts resolve through a Keymap of Actions; see default_keymap and crate::keys.

Structs§

Item
One item in a State.
State
The items and which of them are on.
ToggleGroup
A toggle group builder. Convert it into an Element to render.

Enums§

Action
What a toggle group keyboard shortcut does.
Event
Changes to the selection.
Mode
Whether one or several items can be on.
Position
Where an item sits in an outlined group, which decides its corners.
Variant
How the group is drawn.

Functions§

default_keymap
The default toggle group shortcuts:
divider_style
The line between segments: the group’s border colour.
group_style
The container around the items: nothing for separate toggles, one border for an outlined group.
item
Creates an enabled item.
item_style
The style of one item: a toggle, with square inner corners and no gap when the group is outlined.
toggle_group
Renders the items of state. Without on_event every item renders disabled.