Toggle Group
Sliding Segmented Control
A single-choice segmented control where the selected state travels rather than repaints: the thumb's movement shows where the choice came from and where it went.
What you can change
- the options through options: value and label on each
- the initial choice through defaultValue and the reaction through onChange
- the group heading through label and the line under it through hintTemplate with the {label} placeholder
A link for your AI agent: preview, code and instructions.
Preview
Use it with AI
- 1. Copy the link.
- 2. Write to your agent in your own words and drop the link into the sentence.
- 3. The agent opens the link and installs the component from the registry.
put this on the home page as the hero:
https://vibeui.ru/c/togglegroup-017?lang=en&theme=dark
Not sure where to paste it? Step-by-step guide
Show the full instructions
What the link says, spelled out. Use it when your agent cannot open links — paste this text instead.
Loading…
For developers
The install command lives in the “Component source” block below — a signed link that stays valid for 24 hours.
Technical notes
One file, zero dependencies, the --vibeui-togglegroup-017-* palette. A client component: useState holds the choice. One thumb serves the whole group and moves by translate across a fraction of the width — the animation runs on the compositor and never reflows the layout. The segment width is a fraction of the button count through the --vibeui-togglegroup-017-count variable rather than measured by script, so the server markup already carries the thumb in place and it does not jump on hydration. The buttons sit above the thumb by z-index and the label colour switches on aria-pressed. Arrow keys move focus inside the group, Home and End jump to the edges. Under prefers-reduced-motion the travel is switched off while the label colour keeps the choice visible.
Tags
- toggle-group
- segmented
- animation
- filter
Component source
The same file your agent installs. Here in case you would rather copy it by hand.
Loading…