Stack

Alignment target:@astryxdesign/core v0.7.1 · Stack

HorizontalHorizontalHorizontal
VerticalVerticalVertical

Usage #

Import the component from its dedicated entry. The component loads its structural styles.

Import the theme in your application entry:

TypeScript
import '@astryx-vue/themes/neutral.css'

Component usage:

Vue
<script setup lang="ts">
import { HStack, Stack, StackItem, VStack } from '@astryx-vue/core/Stack'
</script>

Anatomy

ElementDescription
Stack containerLayout container that arranges content along one flex axis.
ItemOptional StackItem wrapper that controls one item in the stack.
ContentCaller-supplied content rendered by a Stack or StackItem.

Best practices #

GuidancePractices
DoUse the gap prop for spacing between items; don't add margins manually.
DoUse StackItem with size="fill" to make one item stretch and fill the leftover space.
Don'tNest stacks inside stacks; try wrap="wrap" first to let items flow to the next line.

Examples #

Stack — Alignment

Start (left)
Center
End (right)
Open in Playground

Buttons sit at the start, the center, and the end of a row.

Stack — Fill item

Olivia ChenEngineering Lead
Marcus RiveraProduct Designer
Aisha PatelMarketing Manager
Open in Playground

An avatar, a name, and a button share a row. The name stretches to fill the space between them.