Skip to content
THE COMPONENT LIBRARY
Skip to content

Component reference

Stack

A notification composition with consistent spacing.

Preview

Live preview

Changes apply to this preview only.

Notification settings

Rows with a label, a hint and an action.

Product updatesA short summary every Friday.
Security alertsSign-ins from a new device.
BillingInvoices and failed payments.

Article layout

A vertical stack with a horizontal meta row.

Guide

Compose instead of override

Layout primitives keep spacing on the token scale. When a page needs a new rhythm, the scale gains a step rather than the page gaining a magic number.

Amélie Bernard·6 min read

Checkout summary

HStack with a spacer keeps the total on the right.

Subtotal€148
Shipping€9
Total€157

Width adapts to the available space

More examples

Different configurations and compositions using the real Pimolu API. Each preview runs independently and follows the site appearance.

Direction

Explore direction with Stack.

Open preview

Gap scale

Every step uses --pimolu-spacing-*: 0, 1, 2, 3, 4, 6, 8 and 12.

Open preview

Alignment and justification

align works on the cross axis, justify on the main axis. The demo uses a centered 160px-tall stage.

Open preview

Usage

Use horizontal/vertical stacks to express content flow and let them wrap where appropriate.

API reference

Generated from the public TypeScript declarations. Native HTML attributes are inherited where the component extends them; this reference includes Pimolu props and selected common native attributes.

PimoluStackProps

Type source
PimoluStackProps public API
NameTypeDefaultDescription
asElementType | undefined`div`Element rendered by the stack. Defaults to `div`.
directionPimoluStackDirection | undefined`column`; HStack/VStack fix itMain axis. Defaults to `column`; HStack/VStack fix it.
gapPimoluStackSpace | undefined`3` (12px)Gap between children. Defaults to `3` (12px).
alignPimoluStackAlign | undefined—Cross-axis alignment.
justifyPimoluStackJustify | undefined—Main-axis distribution.
wrapboolean | undefinedfalseAllow children to wrap onto several lines.
fullWidthboolean | undefinedfalseFill the available inline size.
defaultValuestring | number | readonly string[] | undefined—Standard React/HTML attribute.
classNamestring | undefined—Standard React/HTML attribute.
styleCSSProperties | undefined—Standard React/HTML attribute.
aria-labelstring | undefined—Defines a string value that labels the current element.
childrenReactNode—Standard React/HTML attribute.
onChangeChangeEventHandler<HTMLElement, Element> | undefined—Standard React/HTML attribute.
onClickMouseEventHandler<HTMLElement> | undefined—Standard React/HTML attribute.
as

ElementType | undefined

Default: `div`

Element rendered by the stack. Defaults to `div`.

direction

PimoluStackDirection | undefined

Default: `column`; HStack/VStack fix it

Main axis. Defaults to `column`; HStack/VStack fix it.

gap

PimoluStackSpace | undefined

Default: `3` (12px)

Gap between children. Defaults to `3` (12px).

align

PimoluStackAlign | undefined

No default extracted.

Cross-axis alignment.

justify

PimoluStackJustify | undefined

No default extracted.

Main-axis distribution.

wrap

boolean | undefined

Default: false

Allow children to wrap onto several lines.

fullWidth

boolean | undefined

Default: false

Fill the available inline size.

defaultValue

string | number | readonly string[] | undefined

No default extracted.

Standard React/HTML attribute.

className

string | undefined

No default extracted.

Standard React/HTML attribute.

style

CSSProperties | undefined

No default extracted.

Standard React/HTML attribute.

aria-label

string | undefined

No default extracted.

Defines a string value that labels the current element.

children

ReactNode

No default extracted.

Standard React/HTML attribute.

onChange

ChangeEventHandler<HTMLElement, Element> | undefined

No default extracted.

Standard React/HTML attribute.

onClick

MouseEventHandler<HTMLElement> | undefined

No default extracted.

Standard React/HTML attribute.

PimoluHStackProps

Type source
PimoluHStackProps public API
NameTypeDefaultDescription
onChangeChangeEventHandler<HTMLElement, Element> | undefined—Standard React/HTML attribute.
defaultValuestring | number | readonly string[] | undefined—Standard React/HTML attribute.
classNamestring | undefined—Standard React/HTML attribute.
styleCSSProperties | undefined—Standard React/HTML attribute.
aria-labelstring | undefined—Defines a string value that labels the current element.
childrenReactNode—Standard React/HTML attribute.
onClickMouseEventHandler<HTMLElement> | undefined—Standard React/HTML attribute.
fullWidthboolean | undefinedfalseFill the available inline size.
asElementType | undefined`div`Element rendered by the stack. Defaults to `div`.
gapPimoluStackSpace | undefined`3` (12px)Gap between children. Defaults to `3` (12px).
alignPimoluStackAlign | undefined—Cross-axis alignment.
justifyPimoluStackJustify | undefined—Main-axis distribution.
wrapboolean | undefinedfalseAllow children to wrap onto several lines.
onChange

ChangeEventHandler<HTMLElement, Element> | undefined

No default extracted.

Standard React/HTML attribute.

defaultValue

string | number | readonly string[] | undefined

No default extracted.

Standard React/HTML attribute.

className

string | undefined

No default extracted.

Standard React/HTML attribute.

style

CSSProperties | undefined

No default extracted.

Standard React/HTML attribute.

aria-label

string | undefined

No default extracted.

Defines a string value that labels the current element.

children

ReactNode

No default extracted.

Standard React/HTML attribute.

onClick

MouseEventHandler<HTMLElement> | undefined

No default extracted.

Standard React/HTML attribute.

fullWidth

boolean | undefined

Default: false

Fill the available inline size.

as

ElementType | undefined

Default: `div`

Element rendered by the stack. Defaults to `div`.

gap

PimoluStackSpace | undefined

Default: `3` (12px)

Gap between children. Defaults to `3` (12px).

align

PimoluStackAlign | undefined

No default extracted.

Cross-axis alignment.

justify

PimoluStackJustify | undefined

No default extracted.

Main-axis distribution.

wrap

boolean | undefined

Default: false

Allow children to wrap onto several lines.

PimoluVStackProps

Type source
PimoluVStackProps public API
NameTypeDefaultDescription
onChangeChangeEventHandler<HTMLElement, Element> | undefined—Standard React/HTML attribute.
defaultValuestring | number | readonly string[] | undefined—Standard React/HTML attribute.
classNamestring | undefined—Standard React/HTML attribute.
styleCSSProperties | undefined—Standard React/HTML attribute.
aria-labelstring | undefined—Defines a string value that labels the current element.
childrenReactNode—Standard React/HTML attribute.
onClickMouseEventHandler<HTMLElement> | undefined—Standard React/HTML attribute.
fullWidthboolean | undefinedfalseFill the available inline size.
asElementType | undefined`div`Element rendered by the stack. Defaults to `div`.
gapPimoluStackSpace | undefined`3` (12px)Gap between children. Defaults to `3` (12px).
alignPimoluStackAlign | undefined—Cross-axis alignment.
justifyPimoluStackJustify | undefined—Main-axis distribution.
wrapboolean | undefinedfalseAllow children to wrap onto several lines.
onChange

ChangeEventHandler<HTMLElement, Element> | undefined

No default extracted.

Standard React/HTML attribute.

defaultValue

string | number | readonly string[] | undefined

No default extracted.

Standard React/HTML attribute.

className

string | undefined

No default extracted.

Standard React/HTML attribute.

style

CSSProperties | undefined

No default extracted.

Standard React/HTML attribute.

aria-label

string | undefined

No default extracted.

Defines a string value that labels the current element.

children

ReactNode

No default extracted.

Standard React/HTML attribute.

onClick

MouseEventHandler<HTMLElement> | undefined

No default extracted.

Standard React/HTML attribute.

fullWidth

boolean | undefined

Default: false

Fill the available inline size.

as

ElementType | undefined

Default: `div`

Element rendered by the stack. Defaults to `div`.

gap

PimoluStackSpace | undefined

Default: `3` (12px)

Gap between children. Defaults to `3` (12px).

align

PimoluStackAlign | undefined

No default extracted.

Cross-axis alignment.

justify

PimoluStackJustify | undefined

No default extracted.

Main-axis distribution.

wrap

boolean | undefined

Default: false

Allow children to wrap onto several lines.

Accessibility

  • Ensure the visual order matches the DOM reading and keyboard order.
Read the accessibility guide →