Skip to content
SENVENLI UI

Stack

Stacks children vertically with a token gap.
Stacked content
import { Stack } from "@senvenli/react/layout";

Examples

Aligned

`align` places the children on the inline axis.

As a list

`as` keeps the list semantics while the stack sets the rhythm.

Horizontal: A row of actions

Short items side by side with one gap.

Horizontal: Space between

A title at the start and its actions at the end.

Horizontal: Wrapping

Items move to a new line when the row runs out of room.

Guidelines

When to use it

  • Laying out content top to bottom with even spacing.
  • Placing buttons, tags or short items in a row.

Use something else when

  • Children form equal columns. Grid
  • Panes side by side should stack below a width. Split

Do and avoid

  • Space with space (gap), never margins on the children.

Accessibility

Built in

  • Layout only; no role.
  • Follows the reading direction, so it flips in right-to-left languages.

API reference

Stack

padding
Space
paddingInline
Space
paddingBlock
Space
background
Background
radius
Radius
shadow
Shadow
border
Border
as
LayoutElement
direction
"vertical" | "horizontal"

vertical (default): children stacked on the block axis.

space
Space

Gap between children (gap, never margins).

align
"start" | "end" | "center" | "stretch" | Align

Cross-axis alignment (inline axis).

justify
Justify

Distribution along the inline axis; start is the reading start, so RTL flips with it.

wrap
boolean

Wrap onto new lines when space runs out. Default true.

Also takes 375 standard DOM and ARIA attributes (id, aria-label, event handlers…).