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.
Import
Section titled “Import”<script> import Tooltip from "@invisible-ui/svelte/Tooltip.svelte";</script><script setup> import { Tooltip } from "@invisible-ui/vue";</script>import { Tooltip } from "@invisible-ui/react";<script type="module"> import "@invisible-ui/elements/define";</script>
<ds-tooltip></ds-tooltip>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>| Prop | Type | Default | Description |
|---|---|---|---|
text * | string | — | The tooltip label. |
placement | TooltipContext["placement"] | "top" | Preferred placement; flips when there's no room. |
openDelay | number | 300 | Delay before showing on hover, in ms (focus shows immediately). |
closeDelay | number | 100 | Delay before hiding on leave, in ms. |
| Prop | Type | Default | Description |
|---|---|---|---|
text * | string | — | Tooltip label text. |
placement | Placement | "top" | |
openDelay | number | 300 | |
closeDelay | number | 100 |
Slots: default.
| Prop | Type | Default | Description |
|---|---|---|---|
text * | string | — | Tooltip label text. |
placement | Placement | "top" | Preferred placement; flips when there is no room. |
openDelay | number | 300 | Delay before showing on hover, in ms. |
closeDelay | number | 100 | Delay before hiding on leave, in ms. |
children | ReactNode | — | The trigger: wrap a focusable element. |
| Attribute | Reactive | Description |
|---|---|---|
text * | yes | |
placement | yes | Floating UI placement, top by default |
open-delay | — | ms, 300 |
close-delay | — | ms, 100 |
Reactive attributes re-render the element when they change after the first render.
The default slot is the trigger (wrap a focusable element).
Accessibility
Section titled “Accessibility”- Shows on hover and keyboard focus; the trigger gets
aria-describedbypointing at therole="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-describedbydirectly on your own element) use the headlesscreateTooltip.
Example
Section titled “Example”<Tooltip text="Copy to clipboard"> <button>Copy</button></Tooltip>Themeable via --ds-tooltip-*.