[data-reveal]{opacity:1!important;transform:none!important}
AntelopeJS DMS
DocumentationStacks

Stacks

HStack and VStack are flexbox rows and columns for toolbars, side-by-side panels and page scaffolds.

HStack lays its children out left to right, VStack top to bottom. alignment sets the cross axis, distribution shares the free space along the main axis, and spacing is the gap between children. A Spacer between children takes the leftover space, so a toolbar's title stays left and its actions move right.

HStack

Horizontal stack HStack
Connecting to the DMS preview…
Connecting DMS 0.25.8 1 option set
src/pages/overview.ts ts
import { HStack, Spacer } from "@antelopejs/interface-dms/base/stack";
import { LiveToggle } from "@antelopejs/interface-dms/base/live-toggle";
import { PeriodSelector } from "@antelopejs/interface-dms/base/period-selector";

static toolbar = HStack({ alignment: "center" })
  .child("live", LiveToggle())
  .child("spacer", Spacer())
  .child("period", PeriodSelector({ id: "sales" }));
Options of the Horizontal stack block
OptionTypeDefaultDescription
alignment Layout"start" | "center" | "end" | "stretch""center"Alignment of children across the stack.
distribution Layout"start" | "center" | "end" | "space-between" | "space-around" | "space-evenly""start"Distribution of children along the stack.
spacing Layoutstring"8px"Space between children, as a CSS length.
wrap LayoutbooleanfalseWrap children onto a new line when the row runs out of space.
grow Layoutnumber–Share of the parent stack's free space the stack takes.

VStack

Vertical stack VStack
Connecting to the DMS preview…
Connecting DMS 0.25.8 2 options set
src/pages/overview.ts ts
import { VStack } from "@antelopejs/interface-dms/base/stack";

static column = VStack({ alignment: "stretch", spacing: "12px" })
  .child("notice", Banner({ tone: "info", size: "sm", title: "Numbers refresh every 15 minutes." }))
  .child("body", Placeholder({ label: "Content" }));
Options of the Vertical stack block
OptionTypeDefaultDescription
alignment Layout"start" | "center" | "end" | "stretch""center"Alignment of children across the stack.
distribution Layout"start" | "center" | "end" | "space-between" | "space-around" | "space-evenly""start"Distribution of children along the stack.
spacing Layoutstring"8px"Space between children, as a CSS length.
grow Layoutnumber–Share of the parent stack's free space the stack takes.

Recipes

Share a row between panels

A stack fills the width of what holds it, except inside an HStack: there sibling stacks share the row equally, or by their grow. A sidebar at grow: 1 beside a content column at grow: 3 takes a quarter of the row. In a row holding a Spacer, sibling stacks keep their content width so the spacer can push them aside.

Equal-height cards

alignment: "stretch" makes children fill the cross axis, which gives a row of cards one height.

Pitfalls

  • wrap exists on HStack only.

Next steps

Grid

Responsive rows and columns.

Card

Frame a stack under a titled head.