Skip to content

Stagger

Open .md
Live preview

Loading example…

Its children enter one after another, like Reveal, with the whole sequence capped by maxStagger. Each child element receives data-motion and a style variable, so it must pass style and data-* props to its DOM element (every element and most components do).

import { Stagger } from "@jcsoftdev/ui/motion";
export const RevealOnMount: Story = {
render: () => (
<Replay>
{() => (
<Reveal>
<Card className="max-w-sm p-card">Welcome back. Three tasks are waiting for you.</Card>
</Reveal>
)}
</Replay>
),
};

Source of the Storybook story.

Prop Type Default Description
delay number Extra wait before the first child enters, in ms.
inView boolean false Start when the group first scrolls into view instead of on mount.
maxStagger number Longest gap between the first and the last child’s start, in ms. Each step is a quarter of --motion-duration, shortened so long lists still fit in this span (default 1.5 durations).
as "div" | "ol" | "section" | "ul" "div" Element that wraps the children, e.g. ul for a list of li.
ref Ref<HTMLElement>
children ReactNode

* marks a required prop.

It also accepts the native props of the element or primitive it renders (for example className, id, aria-* and event handlers).

packages/ui/src/motion/reveal.tsx