Skip to content
LIBRARYFeedback

Sheet ​

m-sheet · Content and actions in a layer above the screen.

Web preview
Open example ↗

Usage ​

vue
<m-button @click="open = true">Filters</m-button>
<m-sheet v-model:open="open" title="Filters" @close="last = $event">
  <m-text>Choose what to show.</m-text>
  <m-button @click="open = false">Apply</m-button>
</m-sheet>

Values and handlers in this snippet belong to your component. The full example below includes their setup.

API ​

PropTypeDefaultPurpose
openbooleanfalsePresents or dismisses the sheet. Bind it with v-model:open.
titlestring—Heading and accessible name. Without it, accessibilityLabel is required.
accessibilityLabelstring—Required when the title is absent or blank; does not add a visible heading.
dismissiblebooleantrueAllows the scrim, Escape, the back gesture, a swipe down and the close button.
fullscreenbooleanfalseFills the usable height instead of fitting the content.
closeLabelstringCloseAccessible name of the close button.
paddingtoken | numberlgInner spacing of the panel.
gap, alignColumn propsnone, stretchApply to the content column.
gestureMotionGesture—Experimental. A slot from createMotionGesture() that receives the sheet drag, for gesture relations.
EventPayloadWhen
update:openbooleanThe sheet asks to open or close.
closebutton | backdrop | escape | back | swipe | programEvery close request, with its reason. program means the app set open to false.

The sheet is controlled: a dismissal emits update:open with false and close with its reason, and the panel leaves when open changes. Content mounts when the sheet opens and is removed after it settles closed. A sheet without title or accessibilityLabel throws a RangeError. dismissible and fullscreen are read when the sheet opens.

Naming a sheet ​

A sheet always requires a name, even with open=false. The trimmed title is used first and displayed as its heading. If the title is absent or whitespace-only, the trimmed accessibilityLabel supplies the name without a heading. If neither contains text, rendering throws RangeError.

Direct imports and globally registered components require either title or accessibilityLabel in their public types. Types cannot determine whether a dynamic string is blank, so runtime validation remains active on setup/render and updates. For an asynchronously loaded title, provide a stable accessibilityLabel while loading or mount the Sheet conditionally with v-if once its name is available; merely setting open=false does not defer validation.

NativeScript ​

The panel lives inside the page, above the Screen content, and is driven by Jolt's bottom sheet: a drag handle with Expand, Collapse and Dismiss accessibility actions, a spring that follows the finger, scroll handoff inside the content, a scrim, keyboard following and Android back. The content snaps to its own height, or to the usable height with fullscreen. MSheet needs an MScreen ancestor. While a sheet is presented, the Screen hides the covered content from assistive technology and VoiceOver treats the panel as modal; focus returns to the previous element after the sheet settles.

On iOS, the scrim covers the whole window and the panel's surface reaches the bottom edge. Its content stays above the home indicator and clear of the notch in landscape; the spacing follows rotation while the sheet is open. This also applies inside a scrolling Screen.

On Android 14 and later, in an app whose manifest sets android:enableOnBackInvokedCallback="true", the panel follows the system back gesture before it commits: it moves toward its closed position as the finger travels and returns if the gesture is cancelled. A completed gesture and the back key both report back. The handle's Dismiss accessibility action reports swipe, like the drag it stands for. A sheet with dismissible set to false shows no preview and stays open. Apps created with create-mavis set the manifest flag.

Core's Frame navigation honors the cancelled back event. A router that owns the Android back press, such as vue-router-ns, asks a claimant first:

ts
app.use(
  createMavis({
    theme: mavis,
    darkTheme: midnight,
    claimSystemBack: (claimant) => router.claimSystemBack(claimant),
  }),
)

Routed modals with their own stack remain a vue-router-ns feature; MSheet is a component inside a page.

Web ​

The Web renderer keeps a modal <dialog> for focus containment, Escape/backdrop and restoration of the previously focused opener. Jolt owns the inner panel's translation, including entrance, interruption and departure. The backdrop has its own CSS color transition; it does not map drag distance to opacity.

Drag only the dedicated handle. Release springs to open or closed using position and velocity; a completed dismissal emits swipe. Catching an active snap continues from its visible position. The close button offers the same outcome without a gesture. A rejected controlled dismissal springs back open. dismissible=false disables the handle as well as ordinary dismissal controls. Page scrolling pauses while the modal is open; body scrolling remains independent of the handle.

The panel uses a fixed top-left transform origin. Content height, window resize and visual-viewport keyboard changes cancel contact, remeasure the two destinations and retarget the current open/closed intent. Pinch zoom keeps the current geometry. This bounded policy avoids pivot rebasing; it is not nested-scroll handoff or support for transformed/zoomed ancestors. A stale completion cannot close a reopened presentation. Native geometry/gesture implementation remains independent.

Spatial playback follows live reduced motion; the backdrop's CSS transition is also removed under that preference. The browser can still force-close a non-dismissible dialog after repeated Escape presses; the bound state follows.

The handle's bar stretches sideways while it is held and springs back when released, on Web and NativeScript, so the grab is visible before the panel moves. It stays still on a non-dismissible sheet and under reduced motion. The bar is decoration: the handle's name, keyboard actions and gesture are unchanged.

Interrupted programmatic close ​

An app can enable dismissal and set open=false in the same Vue update. Once the sheet closes, focus returns to its opener. If a document becomes hidden during departure, Mavis releases the modal immediately. If another layout takes ownership of the panel and Jolt can no longer report settlement, Mavis completes the close after a bounded wait. Setting open=true during that wait keeps the new presentation open and reconnects its gesture controller.

Chromium on macOS, using the keyboard. Confirming the instructions unlocks and closes the sheet in one update. Enter opens it again from the restored focus. During Close and reopen, a second layout takes ownership of the departing panel. The review resumes, stays open, and Escape returns focus to Review instructions.

Desktop ​

MSheet opens inside the window on the Mac and on Windows, centred over a scrim, with the keyboard kept in it until it closes and then given back to the control that opened it; Escape, the scrim and the close button close it with the reasons of the contract. There are no detents: it takes the height of its content up to the window and scrolls beyond it, fullscreen fills the window, and gesture and returnFocus have no effect. See Desktop components.

Limits ​

  • Snap points other than the content height and the full height are not exposed yet.
  • The Expand and Collapse accessibility actions on the native handle use Jolt's English labels.
  • A native sheet caught mid-dismissal springs back open and emits update:open with true.

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 { computed, ref } from 'vue'
import type { SheetCloseReason } from '@getcortexlabs/mavis-core'

const { t, locale } = useCatalogLocale(() => props.lang)

const props = withDefaults(defineProps<{ lang?: 'en' | 'pt' }>(), { lang: undefined })

const pt = computed(() => (props.lang ?? locale.value) === 'pt')
const open = ref(false)
const tall = ref(false)
const held = ref(false)
const name = ref('')
const last = ref<SheetCloseReason>()
const reasons: Record<SheetCloseReason, [string, string]> = {
  button: ['by the close button', 'pelo botão de fechar'],
  backdrop: ['by the scrim', 'pelo fundo'],
  escape: ['by the Escape key', 'pela tecla Escape'],
  back: ['by the back gesture', 'pelo gesto de voltar'],
  swipe: ['by a swipe down', 'por um arrasto para baixo'],
  program: ['by the app', 'pelo app'],
}
</script>

<template>
  <m-column gap="md">
    <m-row gap="sm" wrap>
      <m-button id="sheet-demo-open" @click="open = true">{{
        t(pt ? 'Abrir sheet' : 'Open sheet')
      }}</m-button>
      <m-button variant="secondary" @click="tall = true">{{
        t(pt ? 'Tela inteira' : 'Full screen')
      }}</m-button>
      <m-button variant="ghost" @click="held = true">{{
        t(pt ? 'Sem dispensar' : 'Not dismissible')
      }}</m-button>
    </m-row>
    <m-text v-if="last" variant="caption" tone="muted">{{
      t(pt ? `Fechado ${reasons[last][1]}.` : `Closed ${reasons[last][0]}.`)
    }}</m-text>

    <m-sheet
      id="sheet-demo-panel"
      v-model:open="open"
      :title="t(pt ? 'Filtros' : 'Filters')"
      :closeLabel="t(pt ? 'Fechar' : 'Close')"
      gap="md"
      @close="last = $event"
    >
      <m-text tone="muted">{{
        t(
          pt
            ? 'O conteúdo fica acima da tela e pode rolar. Arraste a alça, toque fora ou use o botão.'
            : 'Content sits above the screen and can scroll. Drag the handle, tap outside or use the button.',
        )
      }}</m-text>
      <m-input v-model="name" :label="t(pt ? 'Buscar' : 'Search')" icon="search" />
      <m-row gap="sm" justify="end">
        <m-button variant="ghost" @click="open = false">{{
          t(pt ? 'Cancelar' : 'Cancel')
        }}</m-button>
        <m-button id="sheet-demo-apply" @click="open = false">{{
          t(pt ? 'Aplicar' : 'Apply')
        }}</m-button>
      </m-row>
    </m-sheet>

    <m-sheet
      v-model:open="tall"
      :title="t(pt ? 'Detalhes' : 'Details')"
      :closeLabel="t(pt ? 'Fechar' : 'Close')"
      fullscreen
      gap="md"
      @close="last = $event"
    >
      <m-text v-for="n in 12" :key="n" tone="muted">{{
        t(pt ? `Linha ${n} de um conteúdo longo.` : `Line ${n} of a long body.`)
      }}</m-text>
      <m-button @click="tall = false">{{ t(pt ? 'Concluir' : 'Done') }}</m-button>
    </m-sheet>

    <m-sheet
      v-model:open="held"
      :title="t(pt ? 'Confirmar' : 'Confirm')"
      :dismissible="false"
      gap="md"
      @close="last = $event"
    >
      <m-text tone="muted">{{
        t(
          pt
            ? 'Esta sheet só fecha pelas ações abaixo.'
            : 'This sheet closes only through the actions below.',
        )
      }}</m-text>
      <m-row gap="sm" justify="end">
        <m-button variant="secondary" @click="held = false">{{
          t(pt ? 'Agora não' : 'Not now')
        }}</m-button>
        <m-button @click="held = false">{{ t(pt ? 'Confirmar' : 'Confirm') }}</m-button>
      </m-row>
    </m-sheet>
  </m-column>
</template>

In context ​

Accessible names, focus and screen-reader checks.

Jolt bottom sheet · Jolt Web · #236

Watch the shared Kinetic recordings, including Sheet.

Mavis alpha.5 with Jolt RC.7 supports overlays inside animated cards. See composition boundaries and the static fallback.

Experimental image, icon, Sheet and Dialog integrations are described in Images and physics. They require Jolt RC.11 and are included in Mavis alpha.8.

Web focus restoration ​

Included in alpha.11. returnFocus supplies an explicit element ID or a function (reason: SheetCloseReason) => HTMLElement | null | undefined. Omit it to use the captured focused element. The function runs after the native dialog closes, so Safari pointer activation does not need to focus the trigger before opening.

vue
<m-button id="tools-trigger" @click="open = true">Tools</m-button>
<m-sheet v-model:open="open" title="Tools" return-focus="tools-trigger">
  <!-- content -->
</m-sheet>

The existing close event reports the close request; it does not mean the departure has finished. Restoration waits for the browser's native close event, ignores stale close events after reopening, and skips disconnected, hidden, disabled or inert destinations. It preserves focus already placed on another control. For navigation, use a getter returning null when the application will place focus, or returnFocus=false to skip Mavis restoration. The browser may still perform its own default restoration. This option is Web-only; native accessibility presentation is unchanged.

Components for NativeScript and Web. Starting with Vue.