Radio Group
Swatch Picker
A row of colour swatches on radios: the selected one springs up with a ring in its own colour while its neighbours step aside.
What you can change
- the colour names through optionText — they are the captions a screen reader reads
- defaultValue — which swatch starts selected
- size — the swatch diameter in pixels
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/radio-020?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-radio-020-* palette. A server component: radios inside the labels hold the selection and there is no React state. The group is a fieldset with a legend, and every swatch is a label carrying an invisible input type="radio", a dot and a hidden colour name for screen readers. The dot colour arrives through the --vibeui-radio-020-dot variable in the label's style attribute, the diameter through --vibeui-radio-020-size which the size prop sets. The selected look is assembled by :has(input:checked) selectors: a box-shadow ring on the label (its padding is the gap), transform:scale(1.18) on the dot and a checkmark growing from scale(0.4). The neighbours move 0.1875rem aside, the previous one reached by a :has(+ …) selector. The checkmark turns black or white through oklch(from …) because the swatch lightness is unknown in advance. The theme comes from color-scheme through light-dark(), while the .dark class and data-theme="dark" declare color-scheme:dark.
Tags
- radio
- swatch
- color
- has-selector
- spring
Component source
The same file your agent installs. Here in case you would rather copy it by hand.
Loading…