Items that move between pinned and unpinned groups as the same node.
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/pinned-list.jsonnpx shadcn@latest add https://animate.prequelui.terravidhal.me/r/pinned-list.json
Turn on the motion
npx @prequelui/cli@latest animate pinned-listThe 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 { PinnedList } from "@/components/prequelui/pinned-list";
export default function Demo() {
return (
<PinnedList
defaultItems={[
{ id: "aurora", label: "Aurora", pinned: true },
{ id: "atlas", label: "Atlas", pinned: true },
{ id: "beacon", label: "Beacon", pinned: false },
]}
/>
);
}import { PinnedList } from "@/components/prequelui/pinned-list";
export function Variant() {
return (
<PinnedList tempo={1.2}>
…
</PinnedList>
);
}Animation
An item is not removed and recreated when it changes group: it is the same node moving to a new parent. Motion interpolates its position and size, so the row travels between the two lists in one continuous gesture.
- Move spring: 320 / 25 with mass 0.8.
- `layoutId` is shared across the two groups to keep the node identity.
- The pin icon fades and scales in 220 ms on the soft curve.
- The moving row is raised to z-index 10 while it travels.
- Reduced motion reorders the rows without interpolation.
API Reference
Each part accepts the usual HTML props in addition to the motion props below. No accessibility prop is hidden behind the animation layer.
PinnedList
| Prop | Type | Default |
|---|---|---|
| items | PinnedItem[] | — |
| defaultItems | PinnedItem[] | four demo items |
| onItemsChange | (items: PinnedItem[]) => void | — |
| pinnedLabel | string | "Pinned" |
| unpinnedLabel | string | "Everything else" |
| className | string | — |