Single-choice options with a dot that grows into place.
Installation
Install the packages
npm install @prequelui/react motion@prequelui/react reuses the primitive library your components already depend on.
Add the component
npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/radio-group.jsonnpx shadcn@latest add https://animate.prequelui.terravidhal.me/r/radio-group.json
Turn on the motion
npx @prequelui/cli@latest animate radio-groupThe CLI finds the component through components.json, swaps the import and removes the CSS animation classes that Motion replaces.
Usage
Import the component and compose it exactly like the primitive it wraps. Motion is enabled by default; the tempo prop scales every duration and softens every spring.
import { RadioGroup } from "@/components/prequelui/radio-group";
export default function Demo() {
return (
<RadioGroup>
{/* compose the parts exactly like the underlying primitive */}
</RadioGroup>
);
}import { RadioGroup } from "@/components/prequelui/radio-group";
export function Variant() {
return (
<RadioGroup tempo={1.2}>
…
</RadioGroup>
);
}Animation
This primitive keeps the API and semantics of the underlying component and adds motion at the surface edges. Entrances are slower and more settled than exits, so closing never feels like waiting.
- Springs for position, scale and size; tweens for colour and opacity.
- The exit is shorter than the entrance, and keeps the current position as its starting point.
- All measurements are taken again when content or font metrics change.
- With reduced motion, the surface fades in place and never travels.
API Reference
Every part takes exactly the props of the Radio Group primitive. The animated surface adds only motion props, so the accessibility tree and keyboard behaviour stay the same.
Radio Group
| Prop | Type | Default |
|---|---|---|
| children | ReactNode | — |
| disabled | boolean | false |
| transition | Transition | spring.press |
| className | string | — |