Skip to content
Back

Toggle groupPro

A row of toggles, single or multiple: one fill glides between options, or each fades in and neighbours join like a formatting toolbar.

oxyn add toggle-group
The code is part of Oxyn Pro

The preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.

Get Pro

Rendered from Rust at build time · goes live when visible

When to use

  • Formatting toolbars, view toggles, tool sets in the composer.

When not to use

  • Switch between two to six options: use Segmented Control instead.
  • Choose which tools the agent may use: use Tools menu instead.
  • On or off for things that apply right away: use Switch instead.

Installation

Toggle group is part of Oxyn Pro; the preview is free. Pro items install with the oxyn CLI once your licence is signed in; until then Pro members copy the code from this page.

Terminal
oxyn add toggle-group

Usage

Dioxus · rust
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Examples

Toolbar

Formatting toolbar: pressed neighbours join.

Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Single

Single choice: one fill glides.

Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Text

Text options for agent mode.

Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Dense

Small, for dense desktop toolbars.

Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

API reference

ToggleGroup

PropTypeDefaultDescription
itemsrequiredVec<ToggleItem>—Items.
labelrequiredString—Group name.
multipleboolDefault::default()Multiple mode.
valueVec<String>Default::default()Pressed values.
sizeString"md"`sm` · `md`.
disabledboolDefault::default()Disabled.
on_changeEventHandler<Vec<String>>—New value(s).

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
TabIn and out on one item
← →Move focus (no press), wrapping
HomeorEndFirst / last
SpaceorEnterToggle or select

Accessibility

  • Single: radiogroup with radios and aria-checked. Multiple: group with aria-pressed.
  • Icon-only items take their name and tooltip from label.
From the spec

Single → radiogroup / radio / aria-checked; multiple → group / aria-pressed; roving tab stop; fills aria-hidden.

Motion & interaction

Single: one fill glides to the chosen item. Multiple: each fill fades in from 86 % scale and pressed neighbours square their inner corners into one run. The icon dips to 92 % on press; the item box never scales.

Timing
TransitionDurationEasingReduced motion
Glide240 msease.outjump
Fill in180 ms + 220 ms scaleease.outinstant
Press dip160 msease.outnone

Responsive behaviour

  • Stays on one line; md items are 36 px for touch.
Edge cases (spec)

Icon-only items require label (tooltip and name). The strip never wraps; put groups in a wrapping row.

Notes for AI

  • Import ToggleGroup from oxyn_dioxus and include PRIMITIVES_CSS plus the token stylesheet once.
  • A GPUI version exists: ToggleGroupEl in oxyn_gpui.
  • Props to set first: items, label.
  • Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.

Guides

Oxyn · 74 free components · 264 Pro components · 96 screens · 20 blocks · Dioxus and GPUI