Skip to content
LIBRARYLayout

ResizablePanels ​

Added in RC.11.1

Included in Mavis 0.1.0-rc.11.1 for Vue + Vite, Nuxt and NativeScript iOS/Android. Keep core and renderers on the same version.

Web preview
Open example ↗
vue
<MResizablePanels v-model="split" label="Notebook layout" collapsible>
  <template #primary><Notes /></template>
  <template #secondary><Editor /></template>
</MResizablePanels>
PropTypeContract
modelValue / min / maxnumberFirst panel percentage: 40 / 20 / 80.
orientation / direction'horizontal' or 'vertical' / 'ltr' or 'rtl'horizontal / ltr.
height / step / snapnumber / number / readonly number[]360 / 2 / [25,50,75]. Release within 3 percentage points snaps.
collapsible / disabledbooleanBoth false; collapsed first panel uses value 0.
primaryLabel / secondaryLabel / collapseLabel / expandLabelstringLocalizable panel names and controls.

The primary and secondary slots remain mounted when resizing, switching orientation or collapsing. Dragging updates immediately; programmatic changes, collapse and snap use a Jolt spring. Each panel scrolls independently. The controlled model owns persistence.

Web exposes a named separator with current bounds. Use arrows, Shift+arrows, Home/End; Enter toggles collapse when enabled. Pointer cancellation/Escape restores the gesture's original value. Native adds an accessible slider and explicit adjustment buttons alongside direct dragging. Reduced motion changes layout immediately. Two panels are supported; nested panel systems must manage their own minimum usable sizes.

The divider grip stretches along the divider and takes the primary color while it is held. Each keyboard step, adjustment button and snap nudges the grip toward the side the divider moves to, including at the limits. The grip is decorative; the separator's value and focus never move with it.

vue
<script setup lang="ts">
import { computed, ref } from 'vue'
import { useCatalogLocale } from '../locale'
const props = defineProps<{ lang?: 'en' | 'pt' }>()
const { locale } = useCatalogLocale(() => props.lang)
const pt = computed(() => (props.lang ?? locale.value) === 'pt')
const t = (en: string, br: string) => (pt.value ? br : en)
const size = ref(38)
const title = ref('The quiet hours')
const vertical = ref(false)
</script>
<template>
  <MColumn gap="md">
    <MRow justify="between" gap="md" wrap
      ><MColumn gap="xs"
        ><MText text="FIELD NOTES / 03" variant="overline" tone="primary" /><MText
          :text="t('Room to think.', 'Espaço para pensar.')"
          variant="title" /></MColumn
      ><MButton
        :text="vertical ? t('Side by side', 'Lado a lado') : t('Stack panels', 'Empilhar painéis')"
        variant="secondary"
        @click="vertical = !vertical"
    /></MRow>
    <MResizablePanels
      v-model="size"
      :label="t('Notebook layout', 'Layout do caderno')"
      :height="420"
      :orientation="vertical ? 'vertical' : 'horizontal'"
      collapsible
      :primaryLabel="t('Notes', 'Notas')"
      :secondaryLabel="t('Editor', 'Editor')"
      :collapseLabel="t('Hide notes', 'Ocultar notas')"
      :expandLabel="t('Show notes', 'Mostrar notas')"
    >
      <template #primary
        ><MColumn padding="md" gap="lg"
          ><MText
            :text="t('YOUR NOTEBOOK', 'SEU CADERNO')"
            variant="overline"
            tone="muted" /><MColumn gap="sm"
            ><MText text="01 / The quiet hours" weight="600" /><MText
              text="02 / Places to go"
              tone="muted" /><MText text="03 / A different pace" tone="muted" /></MColumn
          ><MText
            :text="
              t(
                'Drag the divider to make this space yours.',
                'Arraste a divisão e encontre seu espaço.',
              )
            "
            variant="caption"
            tone="muted" /></MColumn
      ></template>
      <template #secondary
        ><MColumn padding="lg" gap="lg"
          ><MBadge :text="t('Draft', 'Rascunho')" /><MInput
            v-model="title"
            :label="t('Note title', 'Título da nota')" /><MText
            :text="
              t(
                'There is a particular kind of light at the end of a long afternoon. A reminder to leave a little room for nothing at all.',
                'Existe uma luz especial no fim de uma tarde longa. Um lembrete para deixar um pouco de espaço sem nada marcado.',
              )
            " /><MText
            :text="
              t(
                'Your draft stays here when the panels change.',
                'Seu rascunho continua aqui quando os painéis mudam.',
              )
            "
            variant="caption"
            tone="muted" /></MColumn
      ></template>
    </MResizablePanels>
    <MText id="panel-value" :text="String(size)" variant="caption" tone="muted" />
  </MColumn>
</template>

Desktop ​

On the desktop hosts the divider is dragged with the pointer, or moved with the arrow keys, Home and End while it has the focus, with the same limits, steps and snap points; Enter collapses the first panel when collapsible is set. The Mac shows a resize cursor over the divider and Windows keeps the arrow. See Desktop components.

Components for NativeScript and Web. Starting with Vue.