Toggle Group

A group of toggle buttons where selection is managed collectively.

Single selection

Only one item can be active at a time.

Multiple selection

Any combination of items can be active.

Outline variant

Toggle group with outlined items.

Sizes

Small, default, and large sizes.

Disabled

A disabled toggle group.

Usage

julia
using Suite

# Single selection
ToggleGroup(type="single", default_value="center",
    ToggleGroupItem(value="left", "Left"),
    ToggleGroupItem(value="center", "Center"),
    ToggleGroupItem(value="right", "Right"),
)

# Multiple selection
ToggleGroup(type="multiple",
    ToggleGroupItem(value="bold", "B"),
    ToggleGroupItem(value="italic", "I"),
    ToggleGroupItem(value="underline", "U"),
)

Keyboard Interactions

KeyAction
Enter / SpaceToggle the focused item
Arrow RightFocus next item (horizontal)
Arrow LeftFocus previous item (horizontal)
Arrow DownFocus next item (vertical)
Arrow UpFocus previous item (vertical)

API Reference

ToggleGroup

PropTypeDefaultDescription
typeString"single""single" or "multiple" — selection mode
default_valueString/VectornothingInitially selected value(s)
variantString"default""default" or "outline"
sizeString"default""default", "sm", or "lg"
orientationString"horizontal""horizontal" or "vertical"
disabledBoolfalseDisable all items
classString""Additional CSS classes

ToggleGroupItem

PropTypeDefaultDescription
valueString""Unique identifier for this item (required)
variantString"default"Override group variant
sizeString"default"Override group size
disabledBoolfalseDisable this specific item
children...Any-Item content (text, icons)
classString""Additional CSS classes