# Stagger

A one-time entrance sequence for a small group of related content.

Stagger reveals direct children in document order so a list or grid establishes hierarchy without appearing as one mechanical block. It uses the shared motion tokens and becomes an immediate reveal when the user prefers reduced motion.

```tsx
import { Button, Card, Stagger, Stack, Text } from "@zentara-co/zenos-ui";
import { useState } from "react";

const staggerItems = ["Overview", "Analytics", "Reports", "Members", "Billing", "Settings"];

function StaggerExample() {
  const [replay, setReplay] = useState(0);

  return (
    <Stack gap="4" className="w-full max-w-2xl">
      <Button
        size="sm"
        variant="primary"
        className="self-start"
        onClick={() => setReplay((current) => current + 1)}
      >
        Replay
      </Button>
      <Stagger key={replay} step={70} className="grid grid-cols-2 gap-3 sm:grid-cols-3">
        {staggerItems.map((item) => (
          <Card key={item} className="p-4">
            <Text weight="medium">{item}</Text>
          </Card>
        ))}
      </Stagger>
    </Stack>
  );
}
```

## Import

```tsx
import { Stagger } from "@zentara-co/zenos-ui";
```

## Viewport entrance

Use `inView` for a group that begins below the fold. The sequence plays once, disconnects its observer, and does not replay as the user scrolls away and back. Add `blur` only when the focus pull supports the content rather than decorating it.

```tsx
import { Card, Stagger, Text } from "@zentara-co/zenos-ui";

const staggerItems = ["Overview", "Analytics", "Reports", "Members", "Billing", "Settings"];

function StaggerInViewExample() {
  return (
    <Stagger inView blur step={90} className="grid w-full max-w-2xl gap-3 sm:grid-cols-3">
      {staggerItems.slice(0, 3).map((item) => (
        <Card key={item} className="p-4">
          <Text weight="medium">{item}</Text>
          <Text size="s" color="subtle">
            Reveals once when it enters the viewport.
          </Text>
        </Card>
      ))}
    </Stagger>
  );
}
```

## Composition

Stagger does not own grid or stack layout. Add layout through `className`, and give every direct child a stable key when rendering a collection. Direct children must be elements or components that forward `style` and `data-*` attributes to their root element; text nodes and fragments remain visible but are not animated.

Use `step` to change the delay between children and `initialDelay` to coordinate the group with an immediately preceding element. Keep the total cascade short: a long list should animate a representative first group or skip staggering entirely.

## API

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| children | ReactNode | — | Direct element children animated in document order. Each child must forward style and data attributes. |
| step | number | 70 | Delay in milliseconds between consecutive direct children. |
| initialDelay | number | 0 | Delay in milliseconds before the first child enters. |
| blur | boolean | false | Adds a 4px-to-0 focus pull to the entrance. |
| inView | boolean | false | Waits until the root first intersects the viewport before playing. |
| native props | React.HTMLAttributes<HTMLDivElement> | — | Forwards native attributes, events, aria-*, data-*, className, style, and ref. |

Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props, including className, style, aria-*, and data-*.

## Accessibility

The sequence does not alter DOM order, focus order, names, or roles. Under `prefers-reduced-motion: reduce`, children render in their final state without translation, blur, delay, or animation. Do not place essential status changes behind a staggered entrance.

Source: https://zenos-ui.pages.dev/components/stagger/