Skip to content

Tooltip

A descriptive label shown on hover/focus of a trigger (role="tooltip", linked via aria-describedby).

For a rich, fully customizable card revealed the same way (e.g. a profile preview on a link), use Popover with trigger="hover" — a tooltip is text only.

<script>
import Tooltip from "@invisible-ui/svelte/Tooltip.svelte";
</script>

In Elements, wrap the control:

<ds-tooltip text="Settings for this table">
<ds-button icon-only variant="ghost" aria-label="Settings">…</ds-button>
</ds-tooltip>

In React, wrap the control:

<Tooltip text="Settings for this table">
<Button iconOnly variant="ghost" ariaLabel="Settings">…</Button>
</Tooltip>
PropTypeDefaultDescription
text *string—The tooltip label.
placementTooltipContext["placement"]"top"Preferred placement; flips when there's no room.
openDelaynumber300Delay before showing on hover, in ms (focus shows immediately).
closeDelaynumber100Delay before hiding on leave, in ms.

The default slot is the trigger (wrap a focusable element).

  • Shows on hover and keyboard focus; the trigger gets aria-describedby pointing at the role="tooltip" element while open.
  • WCAG 1.4.13: hoverable (stays open while the pointer is over the tooltip) and dismissable (Escape). Focus is never moved into the tooltip.
  • Positioning (flip/shift) via @floating-ui/dom.
  • For precise control (e.g. putting aria-describedby directly on your own element) use the headless createTooltip.
<Tooltip text="Copy to clipboard">
<button>Copy</button>
</Tooltip>

Themeable via --ds-tooltip-*.