Skip to content

Stack

Lays children out in a vertical column with consistent spacing between items. Stack arranges content; pair it with a Container when the column also needs a max-width or page gutters.

Import

import { Stack } from "@hyzer-labs/ui"

Demo

Gap values map to the --hz-space-* tokens (xs 0.5rem → xl 8rem). near and away are the density distances: context-aware values that tighten inside data-density-shift regions (see the Density tab). The dashed outline marks the Stack itself.

Item 1
Item 2
Item 3
<Stack gap="md">
	<div>Item 1</div>
	<div>Item 2</div>
	<div>Item 3</div>
</Stack>

Props

NameTypeDefaultNote
gap'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'near' | 'away''md'near/away are the density distances — they tighten inside data-density-shift regions.
align'start' | 'center' | 'end' | 'stretch' | 'baseline''stretch'Shared LayoutAlign scale (Stack/Cluster/Grid).
padding'none' | 'sm' | 'md' | 'lg' | 'near' | 'away''none'Both axes. Shared LayoutPadding scale — near/away tighten inside data-density-shift regions.
paddingInline'none' | 'sm' | 'md' | 'lg' | 'near' | 'away'Per-axis override — wins over padding on the inline axis. Same LayoutPadding scale.
paddingBlock'none' | 'sm' | 'md' | 'lg' | 'near' | 'away'Per-axis override — wins over padding on the block axis. Same LayoutPadding scale.
asstring'div'
classstringMerged after the hz-stack class.
childrenSnippet

Theme hooks

What this component promises your CSS. The reference theme styles exactly these — from @layer hz-theme, so your unlayered rules win. See Styling Components for the how.

Root class: .hz-stack

Data attributes

HookValuesStyles
data-gap'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'near' | 'away'Row gap. Default md. The only layout gap scale with an xl rung.
data-align'start' | 'center' | 'end' | 'stretch' | 'baseline'align-items. Default stretch.
data-padding'none' | 'sm' | 'md' | 'lg' | 'near' | 'away'Padding on both axes. Default none.

Accessibility

Stack is a layout primitive with no ARIA semantics. The reading and focus order follow the DOM order of children.