Skip to content
Cloaked Design SystemLayout

VStack

A vertical flex column with a token-scale gap, cross-axis alignment, main-axis distribution, wrap, and scroll options.

Implementation preview
COMPLETE STORYBOOK REFERENCE

Every example. In one place.

Explore every named example, including states, compositions, and theme variants.

7 stories
SELECTED EXAMPLE

Playground

Open controls
Playground selectedOpen canvas
Example sourcepackages/design-system/src/components/layout/VStack/VStack.stories.tsxExport Playground

Implementation preview Local Storybook build 0.2.0-preview.1. Source specification status does not approve this runtime.

Stories + source JSON ↗

Local specification source status: preview. Implementation preview pending sign-off.

A vertical flex column with a token-scale gap, cross-axis alignment, main-axis distribution, wrap, and scroll options.

Design-owned component contract ↗Version 0.2.0-preview.1 · Implementation preview pending sign-off
Implementation API 1 entry point · source-derived preview

Read the actual callable API and preserve its composition constraints. Each union branch is a complete alternative; props marked forbidden cannot be supplied.

import { VStack } from '@cloakedinc/design-system';
VStackStackOwnProps

packages/design-system/src/components/layout/VStack/VStack.tsx:14

PropTypePresenceNotes
gap0 | 4 | 8 | 12 | 16 | 20 | 24 | 32 | 40 | 48 | 56 | 64 | 72 | 80 | 96 | 120 | 240 | undefinedOptionalSpace between children, in `--cds-space-*` steps.
alignStackAlign | undefinedOptionalCross-axis alignment (`align-items`).
justifyStackJustify | undefinedOptionalMain-axis distribution (`justify-content`).
wrapboolean | undefinedOptionalReflow children onto new lines on overflow, where `scroll` keeps them on one line.
scrollboolean | undefinedOptionalTurn the stack into a swipeable overflow strip on the main axis (HStack scrolls horizontally, VStack vertically) and hide the scrollbar. For carousels, set `scroll-snap-align` on the children.
asReact.ElementType<any, keyof React.JSX.IntrinsicElements> | undefinedOptionalRendered element. Defaults to `div`.
classNamestring | undefinedOptional
styleReact.CSSProperties | undefinedOptional
childrenReact.ReactNodeOptional
testIdstring | undefinedOptionalOptional test selector, placed on the `as` element.
idstring | undefinedOptionalDOM id for aria relationships such as `aria-describedby`.
padding0 | 4 | 8 | 12 | 16 | 20 | 24 | 32 | 40 | 48 | 56 | 64 | 72 | 80 | 96 | 120 | 240 | undefinedOptionalPadding on all four sides.
paddingX0 | 4 | 8 | 12 | 16 | 20 | 24 | 32 | 40 | 48 | 56 | 64 | 72 | 80 | 96 | 120 | 240 | undefinedOptionalHorizontal padding (left + right). Overrides `padding` on the X axis.
paddingY0 | 4 | 8 | 12 | 16 | 20 | 24 | 32 | 40 | 48 | 56 | 64 | 72 | 80 | 96 | 120 | 240 | undefinedOptionalVertical padding (top + bottom). Overrides `padding` on the Y axis.
paddingTop0 | 4 | 8 | 12 | 16 | 20 | 24 | 32 | 40 | 48 | 56 | 64 | 72 | 80 | 96 | 120 | 240 | undefinedOptionalTop padding. Overrides `paddingY` and `padding`.
paddingRight0 | 4 | 8 | 12 | 16 | 20 | 24 | 32 | 40 | 48 | 56 | 64 | 72 | 80 | 96 | 120 | 240 | undefinedOptionalRight padding. Overrides `paddingX` and `padding`.
paddingBottom0 | 4 | 8 | 12 | 16 | 20 | 24 | 32 | 40 | 48 | 56 | 64 | 72 | 80 | 96 | 120 | 240 | undefinedOptionalBottom padding. Overrides `paddingY` and `padding`.
paddingLeft0 | 4 | 8 | 12 | 16 | 20 | 24 | 32 | 40 | 48 | 56 | 64 | 72 | 80 | 96 | 120 | 240 | undefinedOptionalLeft padding. Overrides `paddingX` and `padding`.

Only explicit destructured parameter initializers are extracted. Other runtime defaults remain in implementation source.

Overview

Vertical flex column with a token-scale gap — the default replacement for hand-rolled display:flex; flex-direction:column wrappers. It is the most-reached-for layout primitive.

When to use

Reach for VStack any time you stack elements top to bottom with consistent spacing — form fields, list rows, card contents, whole screen bodies. align is the cross (horizontal) axis and justify the main (vertical) axis, so justify="between" pushes the first and last child to the top and bottom edges.

  • Laying out a row left to right? Use HStack.
  • Placing items in equal-width tiles across a fixed column count? Use Grid.
  • Scaffolding a whole route (surface, safe-area insets, sticky header/footer)? Wrap the page in Screen and use VStack for the content inside it.
  • Need a surface behind a centered panel without route chrome? Use Background.

Component specification

$schema../../../specs/component-spec.schema.json
Parts
Id
root
Label
Root
Description
Flex column container. Structural: it lays out children and paints no surface of its own.
Required
true
Allowed Design Choices
Variants
Column
Label
Column
Description
The single vertical flex layout.
Sizes
Alignments
Start
Label
Start
Center
Label
Center
End
Label
End
Stretch
Label
Stretch
Baseline
Label
Baseline
Justifications
Start
Label
Start
Center
Label
Center
End
Label
End
Between
Label
Between
Around
Label
Around
Evenly
Label
Evenly
Variants
Id
column
Label
Column
Description
Vertical flex container.
Platforms
  • ios
  • android
  • web
SizesNone specified
Measurements
Id
stack-gap
Label
Column gap
Kind
example-only
Token
--cds-space-12
Value
12
Unit
px
Applies To
  • root
Notes
Representative value: gap is author-configurable and accepts any step on the spacing scale. 12 is the value rendered and verified by the Playground story.
Layout
Alignment
align sets the cross (horizontal) axis; justify sets the main (vertical) axis.
Flow
Children flow top to bottom and may wrap or scroll on overflow.
Notes
  • Use HStack for a row, Grid for equal-width tiles, and Screen/Background for full-screen scaffolding.
Typography And Color
Typography
Label
Inherited
Description
VStack sets no type; children own their text. Ramp noted for parity.
Token
--cds-type-body-size
Colors
Label
Transparent
Description
VStack paints no background; the surface behind shows through.
Token
--cds-bg-page
States
Id
default
Label
Default
Description
Static column that flexes to its children.
Id
wrap
Label
Wrapped
Description
Children wrap onto additional columns on overflow.
Id
scroll
Label
Scroll
Description
The column becomes a vertical overflow region with a hidden scrollbar.
Behavior
Label
Token gap
Description
gap uses the spacing scale; avoid hand-rolled flex wrappers.
Label
Padding
Description
Padding props map to the spacing scale per edge.
Accessibility
Label
Presentational
Description
VStack is a layout container and adds no roles; order follows DOM order.
Label
Focus order
Description
Reordering visually via justify does not change tab order.
Content Adaptation
Label
Wrap vs scroll
Description
Choose wrap to reflow onto new columns or scroll to keep a single overflow region.
Label
Distribution
Description
between, around, and evenly pin content to the top and bottom edges of a sized column.
Motion Haptics
Motion
Label
None
Description
VStack does not animate layout changes on its own.
Haptics
Label
None
Description
A layout container requests no haptics.
Platform DifferencesNone specified
Implementation preview

This design-owned implementation is ready to try and review. It does not establish product approval. Imported specifications retain their original review status.

Inspect version 0.2.0-preview.1