Icon Toggle Button
Icon toggle buttons are compact controls that use only an icon to switch between two persistent states, selected and unselected.
@volvo-cars/css v3.3.1@volvo-cars/react-icons v4.0.2
An icon toggle button turns a reversible action on or off in a compact space.
When to use
Section titled “When to use”- Turn a feature or setting on or off
- Add or remove items from a persistent list, such as favorites, bookmarks, or pins
- Apply or remove a single filter
- Switch a feature state immediately and reversibly
When not to use
Section titled “When not to use”- The action happens only once, such as deleting, downloading, or refreshing.
- The icon’s meaning or current state is unclear without a label. Use a Toggle Button with a label.
- Users need to choose from more than two states.
- Users choose from a set of filters. Use Chips.
- The button shows or hides content. Use a disclosure button with
aria-expanded, such as an Accordion. - The action is irreversible or high impact, such as submitting, publishing, or deleting content.
- A text label or another control, such as a checkbox, switch, or button, communicates the action more clearly.
Variants
Section titled “Variants”| Variant | Usage |
|---|---|
| Icon Toggle Button | Comes with a backplate. Use it when more emphasis is needed. |
| Icon Toggle Button Clear | Comes without a backplate. Use it when less emphasis is needed. Available in one size. |
Content
Section titled “Content”- Use a familiar and meaningful icon that clearly communicates the action
- Make the selected and unselected icons clearly different
- Provide an accessible label that describes the button’s purpose
- Add a tooltip when the icon’s meaning isn’t obvious
- Don’t use ambiguous or decorative icons
Spacing and layout
Section titled “Spacing and layout”- Use consistent spacing around the icon toggle button and between adjacent controls
- Keep the same button size across similar controls
- Leave enough space between toggle buttons to prevent accidental activation
- Align toggle buttons with surrounding controls and content
- Keep the button’s size across selected, unselected, and loading states