ToggleGroup
Choose one or several options shown at once: filter pills with counts, or joined segments, as buttons or links.
- Use it for
- Choosing one or several options shown at once: filter pills with counts, or joined segments (variant="segmented"), as buttons or URL links.
ToggleGroup preview
Loading example…
Installation
npm install @stackunseen/uiimport { ToggleGroup } from '@stackunseen/ui';@stackunseen/ui/styles.cssUsage and props
Your app owns the selection and the counts. One choice works like radio buttons and several like toggle buttons. Links mode uses real links for views kept in the URL, so it works before scripts load.
Supported inputs
This is the public signature used by this example. Open Code to see how the values and callbacks fit together.
label · options: { value, label, count?, description?, href?, disabled? }[] · type?: single | multiple · value · onValueChange? · allowEmpty? · mode?: buttons | links · variant?: pills | segmented · size?: default | sm · disabled?All props
Loading…
For your coding agent
Give the agent this page instead of a screenshot. The prompt wraps the page with the install and import lines and the rule that your server, not a click, completes an action.
- Contract
- label · options: { value, label, count?, description?, href?, disabled? }[] · type?: single | multiple · value · onValueChange? · allowEmpty? · mode?: buttons | links · variant?: pills | segmented · size?: default | sm · disabled?
- Keeps honest
- Your app owns the selection and the counts. One choice works like radio buttons and several like toggle buttons. Links mode uses real links for views kept in the URL, so it works before scripts load.
- MCP
read_component "ToggleGroup"on the docs endpoint
Keyboard and customization
Keyboard
Tab reaches the group once. Arrow keys, Home and End move between enabled options; in single mode they also select. Space or Enter toggles an option in multiple mode. In links mode every link is in the tab order.
Customization
Change shared colors, spacing, corners and icons with the theme. Use the component's supported props to adapt its content and layout. Customization guide and Theme Studio