React · SwiftUI · agent guides
Toggle
A latching push button: the button cap with a lamp; pressing sinks it past the catch, releasing into on settles it at the latch on the part spring with the…
Use it for
- A mode or a tool that stays on until you turn it off, shown as a key: "Grid", "Snap", Bold / Italic / Underline.
- RadioKeys for one form value among latching caps (time slots, options). Repeating the chosen key keeps it chosen; there is no unlatched state after choosing.
- ToggleGroup for a set of such keys, several at once (multiple) or at most one.
Don't use it for
- A setting in a list (use a switch), one of several views that is always chosen (use a switcher), or an action that happens once (use a button).