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
| Element | Description |
|---|---|
| Stack container | Layout container that arranges content along one flex axis. |
| Item | Optional StackItem wrapper that controls one item in the stack. |
| Content | Caller-supplied content rendered by a Stack or StackItem. |
Best practices #
| Guidance | Practices |
|---|---|
| Do | Use the gap prop for spacing between items; don't add margins manually. |
| Do | Use StackItem with size="fill" to make one item stretch and fill the leftover space. |
| Don't | Nest stacks inside stacks; try wrap="wrap" first to let items flow to the next line. |
Examples #
Stack — Alignment
Start (left)
Center
End (right)
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
An avatar, a name, and a button share a row. The name stretches to fill the space between them.