Skip to content
LIBRARYFeedback

Tooltip ​

Added in alpha.11

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

Web preview
Open example ↗
vue
<MTooltip triggerLabel="About this metric" text="Active members in the last seven days." />
PropTypeDefaultDescription
text / triggerLabelstringrequiredPlain help text and an explicit accessible name for its information button.
icon / variantIconName / ButtonVariantinfo / ghostAppearance of the component-owned trigger.
placementPopoverPlacementtop-starttop-start, top-end, bottom-start or bottom-end; flips and clamps to available space.
delay / disablednumber / boolean350 / falseWeb hover delay in milliseconds. Focus and touch do not wait.

Web help opens on focus, hover or click, remains hoverable and closes on Escape without moving focus. Content is non-interactive. Native exposes the same help through an explicit labelled trigger and MPopover with system-back dismissal; it does not require long press. This component owns its trigger rather than wrapping an arbitrary control. Keep essential instructions visible in the form instead of relying only on a tooltip.

Motion ​

After the hover delay the help pops out of its trigger with a small spring and shrinks back into it when it closes. On Web it leans up to four pixels sideways toward the pointer as it moves across the trigger. The lean stays along the trigger's edge, so the help never slides over the control, and it never takes focus. Touch does not lean, and reduced motion keeps the help still. NativeScript uses Popover's growth from the trigger.

vue
<script setup lang="ts">
import { useCatalogLocale } from '../locale'
const props = defineProps<{ lang?: 'en' | 'pt' }>()
const { locale } = useCatalogLocale(() => props.lang)
const t = (en: string, br: string) => ((props.lang ?? locale.value) === 'pt' ? br : en)
</script>

<template>
  <MCard padding="lg" gap="lg">
    <MRow justify="between" gap="md"
      ><MText
        :text="t('A little context.', 'Um pouco de contexto.')"
        variant="heading"
        :shrink="1" /><MTooltip
        :triggerLabel="t('About this metric', 'Sobre esta métrica')"
        :text="
          t(
            'Active members are people who contributed during the last seven days.',
            'Membros ativos são pessoas que contribuíram nos últimos sete dias.',
          )
        "
    /></MRow>
    <MText text="128" variant="display" />
    <MRow gap="sm" wrap
      ><MBadge text="+24%" tone="success" /><MText
        :text="t('more ideas, together', 'mais ideias, em companhia')"
        tone="muted"
        :shrink="1"
    /></MRow>
    <MSeparator />
    <MText
      :text="
        t(
          'Focus, hover or tap the information button.',
          'Foque, passe o cursor ou toque no botão de informação.',
        )
      "
      variant="caption"
      tone="muted"
    />
  </MCard>
</template>

Desktop ​

On the Mac and on Windows the help opens after delay while the pointer is over the button, at once when the button takes the keyboard or is clicked, and Escape closes it. It never takes the keyboard itself. See Desktop components.

Components for NativeScript and Web. Starting with Vue.