Button group

Snap Rail

A segmented period switch: a pill exactly one third of the track wide glides to the hovered or selected cell.

React + Tailwind, shadcn-compatible: press “Copy for AI” and your Cursor or Claude Code agent installs it with the shadcn CLI.

What you can change

  • the rail name through label — it is also the visible caption above the track
  • the segment captions through optionText
  • defaultValue — which segment starts selected

A link for your AI agent: preview, code and instructions.

Preview

1440pxHost theme
Snap Rail — A segmented period switch: a pill exactly one third of the track wide glides to the hovered or selected cell.

Use it with AI

  1. 1. Copy the link.
  2. 2. Write to your agent in your own words and drop the link into the sentence.
  3. 3. The agent opens the link and installs the component from the registry.
AI
1Pick it here

put this on the home page as the hero:

https://vibeui.club/c/togglegroup-019?lang=en&theme=dark

2Paste into the chat
3Get it in your project

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…

How to use

<Togglegroup019 label="Period" defaultValue="week" />

A sample call. The agent installs the component itself from the registry via the “Copy for AI” link.

Settings

Segment
defaultValue · default: week
Rail name
label · default: Period
Accent
accent · default: theme colour
Background
background · default: theme colour

FAQ

How do I add Snap Rail with Cursor or Claude Code?
Press “Copy for AI” on this page and paste it into your agent's chat. The instruction contains the shadcn CLI install command, the dependencies and what to keep, so the agent installs this exact component instead of recreating a lookalike.
What does Snap Rail depend on?
No npm packages beyond React and Tailwind CSS.
What can I change in Snap Rail?
Adapt: the rail name through label — it is also the visible caption above the track; the segment captions through optionText; defaultValue — which segment starts selected. Keep as installed: the local --vibeui-togglegroup-019-* palette — do not swap it for your theme tokens; the pill width of exactly one cell — calc((100% - 0.5rem) / 3) — and the translateX step of 100% of that width: a pill sized to the text starts jittering on translations again; the three flex:1 1 0 cells: they have to stay equal, otherwise the pill's step stops matching a cell.
Is Snap Rail free?
Yes. The preview is open without an account; with a free account you can copy up to 20 components a month.

For developers

npx shadcn@latest add https://vibeui.club/r/pro/togglegroup-019.json

This command needs a signed link: sign in and open “Component source” below — it issues a working link valid for 30 minutes. All install options

Technical notes

One file, zero dependencies, the --vibeui-togglegroup-019-* palette. A server component: radios inside the labels hold the selection and CSS works out the cell index on its own. The group is a fieldset with a legend, the track holds three equal flex:1 1 0 cells, and the pill is the track's single ::before at calc((100% - 0.5rem) / 3) — exactly one cell wide rather than as wide as the label. The offset comes from translateX(calc(var(--vibeui-togglegroup-019-i) * 100%)); :has() rules raise the variable, first from the checked radio and then from the hovered cell, so the pill leaves for the cursor and comes back once it is gone. The motion is a 0.45s linear(…) spring. The theme comes from color-scheme through light-dark(), while the .dark class and data-theme="dark" declare color-scheme:dark.

Tags

  • togglegroup
  • segmented
  • radio
  • has-selector
  • spring
Component source

The same file your agent installs. Here in case you would rather copy it by hand.

Loading…