# Stack

Vertical flow with a consistent gap between children.

_Diagram: A stack is the vertical flow of a page or form in the content area: heading, text, a field and a button with the same gap between each._

## Live example

### Stack

```html
<div class="stack" style="--stack-gap: var(--dui-space-xs)">
  <p>Stack item one</p>
  <p>Stack item two, with <code>--stack-gap: var(--dui-space-xs)</code></p>
  <p>Stack item three</p>
</div>
```

## API

| Attribute or value | Effect |
| --- | --- |
| `class="stack"` |  |
| `--stack-gap` | space between children (default: `var(--dui-space-m)`) |

Pattern: "The Stack", Every Layout, built with flexbox gap.

--stack-gap does not inherit, so nested stacks keep their own default.

## Specifications

- [Every Layout stack](https://every-layout.dev/layouts/stack/)
- [MDN `gap`](https://developer.mozilla.org/en-US/docs/Web/CSS/gap)

## See also

- [Layouts](https://domestic-ui.odonckers.dev/layouts/index.md)
- [Component API convention](https://domestic-ui.odonckers.dev/index.md#component-api)
- [Accessibility baseline](https://domestic-ui.odonckers.dev/principles/accessibility-baseline-wcag-22-aa.md)
- Source: [`css/layout/stack.css`](https://github.com/odonckers/domestic-ui/blob/main/css/layout/stack.css), [`examples/base.html`](https://github.com/odonckers/domestic-ui/blob/main/examples/base.html)

## How other systems do it

For comparison only; these are not the standard this system follows.

- Apple Human Interface Guidelines: No equivalent
- Material Design 3: No equivalent
- Vercel Geist: No equivalent
