Available on crate feature
toggle only.Expand description
Two-state buttons that stay pressed while an option is on.
A toggle is a button with a pressed state, for options such as “Bold” or
“Show grid” that sit among other buttons rather than in a form. The app
owns the bool and flips it in on_toggle, as with a switch. For a set of
toggles where one or several can be on, use
toggle_group.
Structs§
- Colours
- Background and foreground colours of a toggle, on or off, in a state.
- Metrics
- Resolved dimensions for a
Size. - Toggle
- A toggle builder. Convert it into an
Elementto render.
Enums§
- Action
- What a toggle keyboard shortcut does.
- Size
- Toggle dimensions.
- Variant
- How a toggle looks while it is off.
Functions§
- colours
- Resolves the colours of a toggle. Off, it is muted and takes a fill halfway to the accent on hover, keeping its muted text; on, it takes the accent with full-strength text and darkens a little on hover, so a hovered toggle never looks pressed.
- default_
keymap - The default toggle shortcuts:
- style
- The iced button style of a toggle.
- toggle
- Creates a toggle with a text label, switched off.