Skip to content

H Stack

@astryxdesign/core v0.7.1 · HStack

HAlign: start
ReactTypeScriptNode.js
HAlign: center
DesignEngineeringProduct
HAlign: between
StartMiddleEnd

Usage ​

Stack arranges items in a row or column with consistent spacing. Use the gap prop to control the space between items.

ts
import { HStack } from '@astryx-vue/core/Stack'

HStack is Stack with the direction fixed to a row, so the same props work without repeating direction. gap takes a step from the spacing scale and is the only spacing the row needs: do not add margins to the children.

hAlign places the items along the row — start, center, end, between, around, or evenly. vAlign sets how the items sit against each other vertically, and align is a shorter alias for it. wrap lets a long row continue on the next line instead of overflowing.

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

<template>
  <HStack :gap="2">
    <Badge label="React" />
    <Badge label="TypeScript" />
    <Badge label="Node.js" />
  </HStack>
</template>

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 ​

Common configurations, variations, and states.

Basic

ReactTypeScriptNode.js

Items arranged in a horizontal row with a consistent gap and centered vertical alignment. Use HStack whenever siblings should sit side by side.