How it works
On first appearance each item enters after index × stagger ms: it rises, settles from a 0.97 scale and un-blurs from 6px over 560ms, touching only transform, opacity and filter. Items added later open their height with grid-template-rows 0fr to 1fr, then their content rises in. On removal, new and old data are merged during render, the item fades out, collapses, and only then is removed. Gaps are padding, so nothing leaves a seam. The component only moves items; the row look is yours.
Use it for
- Notification lists and activity feeds where items arrive and leave.
- Result lists that change with a filter or search.
- The first view of a card list that should feel assembled rather than dumped.
Look elsewhere when
- Very long or virtualized lists: only the first few items stagger, and virtualization breaks the exit merge.
- Lists that refresh often: constant motion becomes noise.
- Tables where people compare rows: use plain updates.
Usage
import { StaggerList } from './StaggerList.jsx'
export function Notices({ list, onDelete }) {
return (
<StaggerList
items={list}
getKey={(n) => n.id}
stagger={40}
renderItem={(n) => (
<div className="notice">
{n.title}
<button onClick={() => onDelete(n.id)}>Delete</button>
</div>
)}
/>
)
}Props
| Prop | Type | Default | What it does |
|---|---|---|---|
items | T[] | — | List data. To delete, just remove the item from the array; the component handles the exit animation. |
getKey | (item: T, index: number) => Key | — | Unique key of each item, used to tell additions from removals. |
renderItem | (item: T, index: number) => ReactNode | — | Renders one item. |
stagger | number | 40 | Delay between the entrances of neighbouring items, in ms. |
distance | number | 12 | Entrance movement in px. |
direction | 'up' | 'left' | 'up' | Entrance direction: from below, or from the right. |
staggerLimit | number | 8 | From which item on the delay stops growing, to cap the total time of long lists. |
gap | number | 8 | Space between items in px; it collapses along with an item. |
replayKey | Key | — | Changing it makes all current items enter again, staggered. |
onExited | (key: Key) => void | — | Called after an item finished exiting and was removed from the DOM. |
as | 'ul' | 'ol' | 'div' | 'ul' | Root tag. With ul or ol each item is an li. |
...rest | HTMLAttributes<HTMLElement> | — | Other attributes go to the root element, such as aria-label, aria-live and className. |
Accessibility
- An item that is exiting is aria-hidden and inert, so it cannot be reached while it disappears.
- If focus is inside a deleted item, it moves to the next item, then the previous one, then the list, so keyboard users keep their place.
- A fallback timer removes items even when animations are disabled or the element is hidden.
- Reduced motion shows the final state at once: no fade, movement or stagger, and removed items disappear immediately.
- Give the root an aria-label, and aria-live if new items should be announced.
Motion
First entrance 560ms with the reveal curve (cubic-bezier(0.22, 1, 0.36, 1)), 40ms apart, up to 8 items. Added: height 280ms ease-out, content 420ms (60ms later). Removed: fade 180ms ease-in, then collapse 240ms starting at 160ms.
Add it to your project
Pro members copy a prompt and their coding agent installs the source, the same way as the free components.
StaggerList.jsxstagger-list.csstokens.cssREADME.md
Both files install together. The stylesheet reads the design tokens in tokens.css and carries fallbacks, so it also works alone.





