0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…
Cascades entrance timing across a container's children: linear, reverse, random or a grid wave, with an optional interval such as 40ms.
Overview
data-stagger goes on a container. The runtime numbers its direct children (--vb-stagger-index: 0, 1, 2…), and each child's effect waits index × interval before it starts, so a list or grid builds up one item after another instead of all at once.
data-stagger only sets the timing. Every child still needs its own data-effect, and usually its own data-trigger.
Only direct children are numbered.
Children added or removed later are renumbered automatically.
The runtime that numbers the children ships in every script bundle. The delay rule ([data-stagger] > *) ships in both the core and the full stylesheet.
Options
The value is up to two space-separated tokens, in any order: an ordering mode and an interval. data-stagger with no value means DOM order at 80ms.
Token
Values
Default
Effect
interval
A CSS time: 40ms, 0.1s
80ms
Sets --vb-stagger on the container. Removing the token removes the property again.
mode
(none)
✓
DOM order: the first child gets index 0.
reverse
The last child gets index 0, the first child the highest index.
random
A shuffle seeded by the container's id (or a generated id), so the order is the same on every load. It is reshuffled when the attribute or the children change.
grid
A diagonal wave from the top inline-start cell: index = row + column, so cells on the same diagonal start together. Uses explicit grid-row-start / grid-column-start when every child has one; otherwise rows and columns come from where the children are laid out, which works for auto-placed grids and flex-wrap rows, and mirrors under dir="rtl". Positions are measured when the children are numbered, not on resize.
Effects that stagger
The stagger works through --vb-delay. These effects read it: fade-in, slide-up, slide-in, pop, fade-in slide-up, shadow, fade-out and slide-out. Other effects (for example shake, pulse, reveal, typewriter) ignore it.
Events
No events of its own. Each child fires the usual effect events (vb:phase-change, vb:effect-phase-end); see data-trigger.
Styling
Custom property
Set on
Description
--vb-stagger-index
Each direct child (by the runtime)
The child's position in the cascade.
--vb-stagger
The container
The interval. Set by an interval token, or by your own CSS when the attribute has none. Default 80ms.
--vb-delay
Each direct child (by CSS)
calc(var(--vb-stagger-index, 0) * var(--vb-stagger, 80ms)). Override it on a child to take it out of the cascade.
Interval from your own CSS
123
.feature-list {--vb-stagger: 120ms;}
Accessibility
Keep the total short. Ten children at 80ms already take most of a second before the last one starts; a long cascade makes people wait to read.
Under reduced motion (prefers-reduced-motion: reduce or :root[data-motion-reduced]) the delays are dropped together with the animations, and every child is shown at once.
Staggering does not change reading or tab order. A reverse, random or grid cascade only changes when things appear, so the DOM order should still make sense on its own.
Examples
Choreography
Different effects, different intervals
123456789
<uldata-stagger="80ms"><lidata-effect="fade-in slide-up"data-trigger="scroll">First item</li><lidata-effect="fade-in slide-up"data-trigger="scroll">Second item</li></ul><uldata-stagger="120ms"><lidata-effect="slide-in"data-trigger="scroll">Slid in one</li><lidata-effect="slide-in"data-trigger="scroll">Slid in two</li></ul>