data-stagger
Cascades timing to child elements for choreographed entrance sequences.
Overview
The data-stagger attribute goes on a parent element. It sets --vb-stagger-index on each child (0, 1, 2, ...) so CSS can calculate cascading delays for entrance effects.
Basic usage
Each child appears 80ms after the previous one, creating a cascading entrance.
How it works
VB.js sets --vb-stagger-index on each direct child. The built-in CSS rule calculates the delay:
Effects that support --vb-delay (like fade-in, slide-up, pop) automatically pick up the staggered timing.
Choreography
Combine stagger with different effects for varied choreography patterns.
Custom timing
Override the stagger interval with a CSS custom property or inline style:
Attribute reference
| Attribute | Applied to | Description |
|---|---|---|
data-stagger | Parent element | Value is the delay between children (e.g. "80ms"). JS sets --vb-stagger-index on each child. |
| CSS Property | Set on | Description |
|---|---|---|
--vb-stagger-index | Each child | Auto-set by JS (0, 1, 2, ...). Used in delay calculation. |
--vb-stagger | Parent | Overrides the stagger interval. Falls back to attribute value or 80ms. |