Skip to content
LIBRARYMotion

Reveal ​

m-reveal · Show or hide content with a short transition.

Web preview
Open example ↗

Usage ​

vue
<m-button @click="visible = !visible">Details</m-button>
<m-reveal :show="visible">
  <m-card><m-text>A little more context.</m-text></m-card>
</m-reveal>

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

API ​

PropTypeDefaultPurpose
showbooleanfalseInserts or removes content.

Height animates between zero and auto, alongside opacity, through Jolt RC.7 animateSize. Content stays mounted while closing; rapid reversals reuse the subtree and current trajectory. Opening finishes at auto, accommodating subsequent content changes. Before disabling closing content, Mavis restores focus to the opener when focus is still inside. Web uses inert; native blocks interaction and descendant focus. Reduced motion is respected and unmount/deactivation cancels active work. Initially open SSR content does not replay an entrance during hydration.

Also accepts Column props: gap, align, justify, wrap and the common layout props. They apply to the conditional column.

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 visible = ref(false)
</script>

<template>
  <m-column gap="md">
    <m-button @click="visible = !visible">
      {{
        t(
          visible
            ? lang === 'pt'
              ? 'Ocultar detalhes'
              : 'Hide details'
            : lang === 'pt'
              ? 'Mostrar detalhes'
              : 'Show details',
        )
      }}
    </m-button>
    <m-reveal :show="visible">
      <m-card gap="sm">
        <m-text variant="heading">{{
          t(lang === 'pt' ? 'Um pouco mais.' : 'A little more.')
        }}</m-text>
        <m-text tone="muted">{{
          t(
            lang === 'pt'
              ? 'O conteúdo entra e sai com a sua ação.'
              : 'Content enters and leaves with your action.',
          )
        }}</m-text>
      </m-card>
    </m-reveal>
  </m-column>
</template>

In context ​

See the components in a complete vehicle controls screen.

Jolt Web · #236

Accessible names, focus and screen-reader checks.

Components for NativeScript and Web. Starting with Vue.