Tabs with a solid indicator and panels that blur out then in.
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/tabs.jsonnpx shadcn@latest add https://animate.prequelui.terravidhal.me/r/tabs.json
Turn on the motion
npx @prequelui/cli@latest animate tabsThe 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 {
Tabs,
TabsList,
TabsTrigger,
TabsContent,
} from "@/components/prequelui/tabs";
export default function Demo() {
return (
<Tabs defaultValue="overview">
<TabsList>
<TabsTrigger value="overview">Overview</TabsTrigger>
<TabsTrigger value="activity">Activity</TabsTrigger>
</TabsList>
<TabsContent value="overview" className="rounded-lg border p-4">
A calm summary of the workspace.
</TabsContent>
<TabsContent value="activity" className="rounded-lg border p-4">
Every change, in order.
</TabsContent>
</Tabs>
);
}import { Tabs } from "@/components/prequelui/tabs";
export function Variant() {
return (
<Tabs tempo={1.2}>
…
</Tabs>
);
}Animation
The indicator is one solid node that slides between labels; the panels behave like sheets. The old panel leaves in 150 ms with a 12 px shift and a 5 px blur while the new one arrives over it in 300 ms. The tab body glides to the new height.
- Indicator spring: 300 / 30 on position and width.
- Panel exit: 150 ms with a leftward 12 px shift and a 5 px blur.
- Panel entry: 300 ms from the opposite shift.
- Height settles on a 300 / 30 spring with no bounce.
- Reduced motion removes the shift, blur and height glide.
API Reference
Every part takes exactly the props of the Tabs primitive. The animated surface adds only motion props, so the accessibility tree and keyboard behaviour stay the same.
Tabs
| Prop | Type | Default |
|---|---|---|
| value | string | — |
| defaultValue | string | "" |
| onValueChange | (value: string) => void | — |
| transition | Transition | component spring or tween |
| className | string | — |
TabsList / TabsTrigger
| Prop | Type | Default |
|---|---|---|
| value | string | — |
| indicatorTransition | Transition | spring.selection |
| className | string | — |
TabsContent
| Prop | Type | Default |
|---|---|---|
| value | string | — |
| forceMount | boolean | false |
| className | string | — |