Server Component · 0 KB client JS

Stack

One-dimensional stacking with a consistent gap — plus the HStack and VStack presets.

Design review at 10:00

Ship the docs site

Water the plants

Import#

import { Stack, HStack, VStack } from "astralis-ui";

Usage#

Stack is the shorthand for the most common flex layout: children in one direction with even spacing. VStack stacks vertically, HStack lays out horizontally and centers its children on the cross axis — usually what you want for rows of mixed-height content.

Orbit weekly

12 unread updates

Direction#

The base Stack takes a direction prop if you'd rather not pick a preset. It speaks in axes — "vertical" and "horizontal" — rather than CSS's column and row.

vertical (default)

One

Two

horizontal

One

Two

direction is responsive like every other style prop, so the most common layout of all — stacked on mobile, side by side on desktop — is one prop:

One

Two

Three

For two-dimensional layouts or per-child control, step up to Flex or Grid.

Props#

Stack extends Flex (and therefore Box).

PropTypeDefaultDescription
direction"horizontal" | "vertical""vertical"Stacking axis, responsive like every other style prop — direction={{ base: "vertical", md: "horizontal" }} is stack-on-mobile, row-on-desktop. HStack and VStack are presets with this fixed (HStack also centres on the cross axis).
gap"0" – "96" (spacing scale)—Space between children.
alignItems · justifyContent · wrap …Flex props—Stack is a Flex preset — every Flex and Box prop works.