Shopware Design

Tooltip

Usage

The v-tooltip directive attaches a tooltip to any element. Register it once on your app, then bind either a string or an options object. For interactive tooltips, HTML content, or focus support, use the Tooltip component instead.

import { TooltipDirective } from "@shopware-ag/meteor-component-library";

app.directive("tooltip", TooltipDirective);
<template>
  <!-- String shorthand: top placement, 200px width -->
  <button v-tooltip="'Save changes'">Save</button>

  <!-- Placement via modifier -->
  <button v-tooltip.bottom="'Save changes'">Save</button>

  <!-- Options object -->
  <button v-tooltip="{ message: 'Save changes', position: 'right', width: 240 }">
    Save
  </button>
</template>

Options

Bind a string (the message) or an object with:

OptionTypeDefaultDescription
messagestringrequiredThe tooltip text.
position"top" | "right" | "bottom" | "left""top"Placement relative to the element. Takes priority over a placement modifier.
widthnumber | "auto"200Tooltip width in pixels, or "auto".
showDelaynumber100Delay in milliseconds before showing on hover.
hideDelaynumbershowDelayDelay in milliseconds before hiding.
disabledbooleanfalseDisables the tooltip so it never shows.
appearancestring"dark"Adds a mt-tooltip--<appearance> class for custom styling.
showOnDisabledElementsbooleanfalseWraps the element so the tooltip still shows while it is disabled.
zIndexnumbernoneExplicit stacking order for the tooltip layer.

The placement can also be set with a modifier, such as v-tooltip.bottom. When both are present, position wins.

  • Tooltip: when you need an interactive tooltip, formatted content, or keyboard focus support.