# Notification stack

The newest notification whole on a card, the rest peeking under it, opened into a list by the pointer, focus or its control; the shared empty state at zero.

Live variants: https://design.arcadia.is/components/notification-stack

```tsx
import { NotificationStack } from "@arcadia/ui";
```

Open the stack to see earlier updates beside the latest one.

```tsx
import { NotificationStack } from "@arcadia/ui";

<div {...stylex.props(NotificationStackStyles.panel)}><NotificationStack>{LINES.slice(0, 3).map((line) => <ReportLine key={line.id} line={line} />)}</NotificationStack></div>
```

## Accessibility

The control is a button with `aria-expanded` and `aria-controls`; its words are the number of lines, so a reader hears "5 notifications, button, collapsed". The chevron is decoration and takes the control's ink.

While the deck is closed, every card but the newest is `inert` and hidden from the assistive tree: the peeks are the stack's shape, not its words. The deck opens under the pointer or with a key on the control, and stays open while focus is on a line. Focus alone on the control changes nothing.

Escape folds an open deck and keeps focus on the control; a second Escape closes the panel or dialog above it. The stack never traps focus, and a deck with one line has no control to reach.

Under reduced motion the deck cuts to its new shape in one frame and the short fades stay.

## API reference

### NotificationStack

- `expanded` (`boolean`): Whether the deck is open (controlled).
- `defaultExpanded` (`boolean`, default `false`): Opens with the deck open (uncontrolled).
- `onExpandedChange` (`(expanded: boolean) => void`): Called when the deck opens or closes.
- `maxVisible` (`number`, default `3`): Most cards the closed deck shows; the open deck shows every line.
- `label` (`(count: number) => ReactNode`, default `"3 notifications"`): The control's words, by the number of lines.
- `empty` (`ReactNode`): What stands in place of the deck with no lines. Default an `EmptyState`, "Nothing new".
- `rootStyle` (`NotificationStackStyle`): Typed StyleX override: where it sits and its knobs.
- `children` (`ReactNode`): The notification lines, newest first: each stands on a card of its own.

Rest props go to `HTMLAttributes<HTMLDivElement>`.
