layout/DSStack
DSStack
layoutConvenience 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
| Prop | Type | Default | Description |
|---|---|---|---|
| axis | Axis | .vertical | Stack direction. |
| spacing | CGFloat | DSSpacing.md | Gap between children. |
| alignment | HorizontalAlignment | .leading | Cross-axis alignment. |
| contentreq | ViewBuilder | โ | 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)
}