Skip to content
LIBRARYLayout

Column ​

m-column · Arrange content vertically while preserving its natural height.

Web preview
Open example ↗

Usage ​

vue
<m-column gap="md" padding="lg">
  <m-text variant="title">Welcome.</m-text>
  <m-button>Get started</m-button>
</m-column>

API ​

PropTypeDefaultPurpose
gaptoken / numbernoneSpace between children.
alignstart / center / end / stretchstretchHorizontal alignment.
justifystart / center / end / between / aroundstartVertical distribution.
wrapbooleanfalseWraps into columns when height is constrained.

Mavis children preserve their natural height by default. Column, Row and spacing tokens cover everyday composition without requiring consumers to choose native layout classes.

NativeScript Core views placed directly in a Column follow the same rule: unless they set flexShrink themselves, the Column keeps their requested or content height, even when the content exceeds a Screen without scrolling. Set flexShrink="1" on a Core view to let it shrink.

Composition props ​

padding, paddingX, paddingY, radius, grow, shrink, width, height and backgroundColor are also accepted. paddingX and paddingY override their respective sides. Row, Column and Box start without padding; Card starts at lg. grow defaults to 0; shrink follows the parent context.

Full example ​

This file also runs in the NativeScript catalog and the Web preview.

View source
vue
<script setup lang="ts">
import { useCatalogLocale } from '../locale'
import { ref } from 'vue'

const { t } = useCatalogLocale()

withDefaults(defineProps<{ lang?: 'en' | 'pt' }>(), { lang: 'pt' })
const alignments = ['stretch', 'start', 'center', 'end'] as const
const selected = ref(0)
</script>

<template>
  <m-column gap="lg">
    <m-column :align="alignments[selected]" gap="sm">
      <m-button variant="secondary">{{ t('Alpha') }}</m-button>
      <m-button variant="secondary">{{ t('Beta') }}</m-button>
      <m-button variant="secondary">{{ t('Gamma') }}</m-button>
    </m-column>
    <m-button variant="ghost" @click="selected = (selected + 1) % alignments.length"
      >{{ t('Align: ') }}{{ t(alignments[selected]) }}</m-button
    >
  </m-column>
</template>

In context ​

See the components in a complete vehicle controls screen.

See Layout and text for flexible sizing, large text and RTL direction.

Components for NativeScript and Web. Starting with Vue.