layout/DSStack

DSStack

layout
since v1.0

Convenience wrapper around HStack/VStack with design-token spacing pre-applied.

iOS 17+macOS 14+watchOS 10+visionOS 1+

Purpose

Replace ad-hoc HStack/VStack with consistent spacing from the token system.

Interactive Reference

Live showroom

Need the full visual surface?

Screenshots do not scale well across every component, state, and variant. For the real interactive reference, import the package and launch DSShowcaseRoot().

Best for exploring:

variants, states, categories, and real app examples in one place.

Props

PropTypeDefaultDescription
axisAxis.verticalStack direction.
spacingCGFloatDSSpacing.mdGap between children.
alignmentHorizontalAlignment.leadingCross-axis alignment.
contentreqViewBuilderโ€”Stack children.

Examples

Form layout

Vertical stack with token spacing.

swift
DSStack(spacing: DSSpacing.lg) {
    DSTextField(label: "Name", text: $name)
    DSTextField(label: "Email", text: $email)
    DSButton("Continue", variant: .primary, action: next)
}

Related Components