ToggleGroup#

Github

Toggle Group is a collection of toggle buttons that supports the 'on' or 'off' state of a single or multiple toggle buttons.

Basic Definition#

Types#

Toggle Groups are categorized into two types: basic and compact. type

  1. Basic: relatively loose layout.
  2. Compact: relatively tight layout, visually more concise.

Multi-Selection#

Toggle Groups support multi-selection, maintaining consistent styling with single-selection. multiple

Elements#

Toggle Groups typically consist of text/icons, which form the button's display content. They can appear individually or in combination. element

  1. Icon
  2. Text
  3. Divider

Based on combinations, there are the following types:

layout

  1. Pure text button
  2. Left icon + text
  3. Right icon + text
  4. Pure icon button

Interaction States#

Different types of buttons have four states: default, disabled, hover, and focused.

state

Sizes#

Toggle Groups come in two sizes: medium and small.

size

Usage#

When to Use#

  • When users need to select one or multiple options from a group, such as "small, medium, large" in layout adjustments.

When Not to Use#

  • If there are too many options, consider using a dropdown.
  • If used in forms, choose radio buttons or checkboxes for form data entry and submission scenarios.