$npx @dinachi/cli@latest add stagger-list
- Deploys
- Incidents
- Costs
- Latency
- Error rate
variantstaggerdurationdistancekeymetrics.tsx
import { StaggerList, StaggerListItem } from "@/components/ui/stagger-list"
const items = ["Deploys", "Incidents", "Costs", "Latency", "Error rate"]
// Bump run to replay: the sequence only runs on mount.
export function Metrics({ run }: { run: number }) {
return (
<StaggerList key={run} startOnView={false} className="space-y-2">
{items.map((item) => (
<StaggerListItem key={item}>
<div className="rounded-md border px-3 py-2 text-sm">{item}</div>
</StaggerListItem>
))}
</StaggerList>
)
}Usage
import { StaggerList, StaggerListItem } from "@/components/ui/stagger-list"
const results = ["Frankfurt", "London", "Tokyo"]
export function Results() {
return (
<StaggerList>
{results.map((city) => (
<StaggerListItem key={city}>{city}</StaggerListItem>
))}
</StaggerList>
)
}Examples
- Deploys
- Incidents
- Costs
- Latency
- Error rate
Items arriving one after another.
import { StaggerList, StaggerListItem } from '@/components/ui/stagger-list';
export function Example() {
return (
<StaggerList className="w-56 space-y-2">
{items.map((item) => (
<StaggerListItem key={item.id}>{item.label}</StaggerListItem>
))}
</StaggerList>
);
}rise
- Deploys
- Incidents
- Costs
scale
- Deploys
- Incidents
- Costs
blur
- Deploys
- Incidents
- Costs
Rise, scale, or pull into focus.
import { StaggerList, StaggerListItem } from '@/components/ui/stagger-list';
export function Example() {
return (
<StaggerList variant="blur" className="w-32 space-y-2">
{items.map((item) => (
<StaggerListItem key={item.id}>{item.label}</StaggerListItem>
))}
</StaggerList>
);
}- Deploys
- Incidents
- Costs
- Latency
A card wall, where a rise has no direction to follow.
import { StaggerList, StaggerListItem } from '@/components/ui/stagger-list';
export function Example() {
return (
<StaggerList
variant="scale"
stagger={0.04}
className="grid w-64 grid-cols-2 gap-2"
>
{cards.map((card) => (
<StaggerListItem key={card.id}>{card.label}</StaggerListItem>
))}
</StaggerList>
);
}Notes
Motion tier
Needs motion. add --all skips it; install with add --motion or by name.
Variants
riselifts items in from below. Use it for top-to-bottom lists.scalegrows items in place. Use it for grids and card walls.blurbrings items into focus as they rise. Use it sparingly: it animates a filter, so its cost grows with item count.
When to use it
- A list seen for the first time: search results, a dashboard's first paint, a feed's first page.
- Skip it for lists that re-render on every keystroke, or content scrolled back to.
Behaviour
blurleavesfilter: blur(0px)on each item, which makes it a containing block for fixed-position descendants. Useriseorscaleif items contain one.startOnViewtriggers 100px inside the viewport edge, not at a visible fraction.
API
variant"rise" | "scale" | "blur" = "rise"
How each item enters.staggernumber = 0.05
Seconds between items. Keep it between 0.03 and 0.08.delaynumber = 0
Seconds before the first item.durationnumber = 0.3
Seconds for each item's own animation.distancenumber = 8
Travel in px. Ignored by scale.startOnViewboolean = true
Starts on scroll into view instead of mount. Runs once.childrenReactNode
The item's content.Accessibility
- Keeps
ulandlisemantics. - Reduced motion keeps the fade and stagger; drops travel, scale and blur.