Stack
MStack changes direction, spacing and alignment at container-width breakpoints. It keeps the same children mounted, including input state and focus.
<m-stack gap="sm" :responsive="[
{ at: 640, direction: 'row', gap: 'lg' },
{ at: 1000, gap: 'xl', align: 'center' },
]">
<m-input v-model="name" label="Name" :grow="1" />
<m-button>Continue</m-button>
</m-stack>| Prop | Type | Default | Purpose |
|---|---|---|---|
direction | row / column | column | Base direction. |
responsive | StackBreakpoint / readonly StackBreakpoint[] | — | Minimum content-width overrides. |
gap | spacing token / number | none | Base gap. |
align | start / center / end / stretch | stretch | Cross-axis alignment. |
justify | start / center / end / between / around | start | Main-axis distribution. |
wrap | boolean | false | Wrap children. |
Each breakpoint has a positive, unique at and optional direction, gap, align, justify and wrap. Overrides accumulate in ascending order. Width means the Stack's content width after padding: CSS pixels on Web, DIPs on NativeScript. It is not the device width. Common layout props also apply.
SSR and the first hydration render use the base layout. Measurement then applies matching breakpoints without replacing children. Define a usable base, usually a column. NativeScript remeasures on layout/orientation changes. This is responsive flex composition, not a CSS grid engine; use nested Stacks for rows of related content.
<script setup lang="ts">
import { ref } from 'vue'
import { useCatalogLocale } from '../locale'
const { t, locale } = useCatalogLocale()
const draft = ref('')
</script>
<template>
<m-stack gap="md" :responsive="{ at: 560, direction: 'row', gap: 'lg' }">
<m-column :grow="1" gap="sm">
<m-text variant="heading">{{
t(locale === 'pt' ? 'Um espaço que acompanha você.' : 'A space that follows you.')
}}</m-text>
<m-text tone="muted">{{
t(
locale === 'pt'
? 'A coluna vira linha quando há espaço. Seu texto continua aqui.'
: 'The column becomes a row when there is room. Your draft stays here.',
)
}}</m-text>
</m-column>
<m-input
v-model="draft"
:grow="1"
:label="t(locale === 'pt' ? 'Sua próxima ideia' : 'Your next idea')"
/>
</m-stack>
</template>Alpha.9 defers responsive layout changes until the next animation frame and ignores height-only ResizeObserver notifications. Pending work is cancelled on unmount or KeepAlive deactivation. Give the Stack a stable available width (for example, a stretched block or an explicit width); a shrink-to-fit ancestor whose width depends on the Stack's own direction is a circular layout constraint.
Desktop
The Mac and Windows hosts read the stack's own content width after each layout and apply the matching breakpoints, so the same responsive list works there. A change of direction keeps the children, and a field inside keeps its text. motionRegion is accepted and has no effect yet. See Desktop components.