Skip to content

Stack

Stable

Stacks things top to bottom with an even space between them.

Also known as vstack, flex column, vertical stack

Install with npm install @tattva/ui (setup), or copy the code from the kit in Downloads.

Normal space

First

Second

Third

The default space between items.

When to use it

Puts things in a column with one even gap between them. The gap belongs to the stack, not to each item, so spacing stays consistent and shrinks in tighter areas.

Made of: Outer box · Items · Push apart

Use it for

  • A column of cards, paragraphs or form fields that need the same space between them.
  • A list of items, rendered as a real list element.
  • Groups inside groups, with a smaller gap inside each group.

Not for

  • Items that sit side by side in a row: use Cluster.
  • Items laid out in columns: use Grid.
  • Limiting how wide a page column gets: use Container.

Do and avoid

Flight to Lisbon
Hotel, 3 nights
Airport taxi
Do. The stack owns one even gap, so the list feels calm.
Flight to Lisbon
Hotel, 3 nights
Airport taxi
Avoid. Margins on each item make uneven gaps that look like mistakes.

Do

  • Use the space setting between items, not extra margins.
  • Leave more space between groups than inside them.
  • Use a real list when the items are a list.
  • Put stacks inside stacks for groups, with less space inside.

Avoid

  • Do not add margins to items to adjust spacing.
  • Do not use spacing outside the set sizes.
  • Do not space unrelated areas the same as related items.
  • Do not use Stack for a row. Use Cluster.

On a phone

  • Items stack in one column and fill the width of the container.
  • The gap is the same on a phone, unless the area is set to compact density, which makes it 20% smaller.

Seen in products

  • GOV.UK publishes a set of spacing sizes and uses smaller ones on phones.
  • Carbon builds all spacing from an 8px unit.

Build your next AI screen with Tattva.

Free and open, with the code. Start in one line.

Get started