Skip to content
Vertical Jump Designs-uiFront-End Studio
Get Pro

v3.9 is out.

Overlays

Tooltip

Free15.0 KB gzipped

A short, non-interactive label or description that appears on hover and on keyboard focus. Follows the WAI-ARIA tooltip pattern and WCAG 1.4.13: it can be dismissed with Escape, the pointer can move onto it, and it stays open until the pointer or focus leaves. Use Popover for interactive content.

Accessibility: WCAG 2.2 AA · No A or AA violations in light or dark mode · Keys: Tab, Escape · Full report

Import

tsx
import { Tooltip, TooltipProvider } from "@vjdesigns/vjdesigns-ui";

Importing only Tooltip adds about 15.0 KB of minified, gzipped JavaScript to your app (React not included). The stylesheet is shared by every component and loaded once: 75.1 KB gzipped.

Examples

Icon buttons

Tooltips show on hover and keyboard focus, and hide on Escape. relationship="label" makes the tooltip the button's accessible name, which suits icon-only buttons.

tsx
import {
  CopyIcon,
  EditIcon,
  Flex,
  IconButton,
  Tooltip,
  TrashIcon,
} from "@vjdesigns/vjdesigns-ui";

export function IconButtons() {
  return (
    <Flex gap={2}>
      <Tooltip content="Edit" relationship="label">
        <IconButton aria-label="Edit" variant="ghost" tone="neutral">
          <EditIcon />
        </IconButton>
      </Tooltip>
      <Tooltip content="Duplicate" relationship="label" shortcut={["mod", "D"]}>
        <IconButton aria-label="Duplicate" variant="ghost" tone="neutral">
          <CopyIcon />
        </IconButton>
      </Tooltip>
      <Tooltip content="Delete" relationship="label" tone="primary">
        <IconButton aria-label="Delete" variant="ghost" tone="danger">
          <TrashIcon />
        </IconButton>
      </Tooltip>
    </Flex>
  );
}

Placement

By default the tooltip describes its trigger (aria-describedby) and sits above it.

tsx
import { Button, Flex, Tooltip } from "@vjdesigns/vjdesigns-ui";

export function Placement() {
  return (
    <Flex gap={3} wrap="wrap" justify="center">
      {(["top", "right", "bottom", "left"] as const).map((placement) => (
        <Tooltip key={placement} content={`Shown on the ${placement}`} placement={placement}>
          <Button variant="outline" tone="neutral">
            {placement}
          </Button>
        </Tooltip>
      ))}
    </Flex>
  );
}

Accessibility

A tooltip opens on keyboard focus as well as hover. For an icon-only button, relationship="label" makes the tooltip the button's name; otherwise it's a description. Never put links or buttons inside: a tooltip can't take focus.

tsx
import {
  Button,
  CopyIcon,
  Flex,
  IconButton,
  Tooltip,
  TrashIcon,
} from "@vjdesigns/vjdesigns-ui";

export function Accessibility() {
  return (
    <Flex gap={3}>
      <Tooltip content="Copy link" relationship="label">
        <IconButton aria-label="Copy link" variant="ghost" tone="neutral">
          <CopyIcon />
        </IconButton>
      </Tooltip>
      <Tooltip content="Deleted files stay in the trash for 30 days.">
        <Button variant="outline" tone="danger" startIcon={<TrashIcon />}>
          Delete
        </Button>
      </Tooltip>
    </Flex>
  );
}

Translated

Tooltip text is your own content; LocaleProvider sets lang, so it's read in Chinese, and placement mirrors in right-to-left locales.

tsx
import {
  CopyIcon,
  EditIcon,
  Flex,
  IconButton,
  Tooltip,
  LocaleProvider,
} from "@vjdesigns/vjdesigns-ui";
import zhHans from "@vjdesigns/vjdesigns-ui/locales/zh-Hans";

export function Translated() {
  return (
    <LocaleProvider locale="zh-Hans" messages={zhHans}>
      <Flex gap={3}>
        <Tooltip content="编辑" relationship="label">
          <IconButton aria-label="编辑" variant="ghost" tone="neutral">
            <EditIcon />
          </IconButton>
        </Tooltip>
        <Tooltip content="复制链接" relationship="label">
          <IconButton aria-label="复制链接" variant="ghost" tone="neutral">
            <CopyIcon />
          </IconButton>
        </Tooltip>
      </Flex>
    </LocaleProvider>
  );
}

Right to left

The first example again, inside a right-to-left LocaleProvider (Arabic). Layout, spacing and arrow icons mirror, and the components' built-in text is translated. The example's own text stays in English.

Icon buttons

tsx
import { LocaleProvider } from "@vjdesigns/vjdesigns-ui";
import ar from "@vjdesigns/vjdesigns-ui/locales/ar";

// IconButtons is the "Icon buttons" example above.
<LocaleProvider locale="ar" messages={ar}>
  <IconButtons />
</LocaleProvider>

API reference

Tooltip

Tooltip props
PropTypeDefault
childrenRequired

The trigger: exactly one focusable element (a Button, IconButton, link, or input) that accepts a ref, event handlers, and aria-* props. Its existing handlers, ref, and aria-describedby / aria-labelledby are kept.

Disabled elements fire no pointer or focus events, so a disabled button never shows a tooltip. Don't wrap it in a focusable <span>; use aria-disabled="true" on the button instead (and ignore its clicks), so it stays focusable and the tooltip can explain why it's unavailable.

ReactElement—
contentRequired

Short, plain text describing or naming the trigger. Never put interactive content (links, buttons, inputs) here: a tooltip can't receive focus. Use a Popover for that. A dev-mode warning fires if focusable content is found.

ReactNode—
shortcut

Keys of a keyboard shortcut, rendered as a KbdShortcut after content (e.g. ["mod", "S"]).

KbdShortcutProps["keys"]—
placement

Preferred side and alignment, or a logical start / end side that follows the text direction. Flips to the opposite side when there isn't room.

TooltipPlacement"top"
offset

Gap between the trigger and the tooltip, in px.

number8
open

Controlled open state.

boolean—
defaultOpen

Initial open state when uncontrolled.

booleanfalse
onOpenChange

Called with the next open state.

(open: boolean) => void—
delay

Delay before opening on hover or keyboard focus, in ms. Falls back to TooltipProvider, then 400.

number—
closeDelay

Delay before closing after the pointer leaves, in ms; gives the pointer time to reach the tooltip. Falls back to TooltipProvider, then 100.

number—
disabled

Never open, and don't wire aria-* onto the trigger.

booleanfalse
showArrow

Show an arrow pointing at the trigger.

booleantrue
tone

Color. neutral is an inverted bubble; primary is brand blue.

"neutral""primary""neutral"
relationship

How the tooltip relates to the trigger: description (aria-describedby) or label (aria-labelledby).

"description""label""description"
className

Class name for the tooltip element.

string—
style

Style for the tooltip element. Positioning styles are applied on top.

CSSProperties—
id

Id for the tooltip element. Generated when omitted.

string—

TooltipProvider

Optional. Sets shared timing for the tooltips inside it. Tooltips work without a provider, using the defaults.

TooltipProvider props
PropTypeDefault
delay

Default open delay for every tooltip inside, in ms.

number400
closeDelay

Default close delay for every tooltip inside, in ms.

number100
skipDelayDuration

After a tooltip closes, other tooltips open instantly (no delay) for this many ms, so scanning across a toolbar feels immediate. 0 turns it off.

number300
childrenReactNode—

See what changed in each version in the Changelog.

Accessibility report

Tooltip targets WCAG 2.2 AA. Below: a live axe-core audit of this page's examples, Lighthouse scores for the page in both modes, the accessibility behavior built into the component, and the checks only a person can do.

axe-core audit (live)

Running accessibility audit

Checking the examples above…

Lighthouse audit

Light mode

Score 100

35 passed · 0 failed · 30 not applicable · 10 to check by hand

Dark mode

Score 100

35 passed · 0 failed · 30 not applicable · 10 to check by hand

Lighthouse 13.5.0 audits the whole docs page (header and sidebar included), not just the examples, in English. Last run 11/27/2026. Some failed audits carry no weight in the score, so a page can score 100 and still list one.

Built-in behavior

Keyboard

Keyboard
KeyAction
TabFocusing the trigger shows the tooltip.
EscapeHides it without moving focus.

Stays open while the pointer is over the trigger or the tooltip, or the trigger has focus (WCAG 1.4.13).

Roles and states

Roles and states
ElementRoleStates and properties
Tooltiptooltip—
TriggerIts ownaria-describedby → tooltip (or aria-labelledby for an icon button's name)

Manual checks

Automated tools find roughly a third of accessibility issues. Test these in your app, with your content.

Manual accessibility checks
CheckWhat to testWCAG 2.2
KeyboardEvery action works with Tab, Shift+Tab, Enter, Space and the arrow keys, and focus never gets stuck.2.1.1 (A), 2.1.2 (A)
FocusFocus moves in a logical order, is always visible, and isn't hidden behind sticky headers.2.4.3 (A), 2.4.7 (AA), 2.4.11 (AA), 2.4.13 (AAA)
Screen readersNames, roles and states are announced correctly, and status changes are announced without moving focus.1.3.1 (A), 4.1.2 (A), 4.1.3 (AA)
ColorMeaning never depends on color alone; your own colors meet contrast in both modes.1.4.1 (A), 1.4.3 (AA), 1.4.11 (AA), 1.4.6 (AAA)
Zoom and reflowAt 200% text size and at 320px wide (400% zoom), nothing is cut off and no sideways scrolling is needed.1.4.4 (AA), 1.4.10 (AA), 1.4.12 (AA)
Pointer targetsClick and tap targets are at least 24×24px (44×44px for AAA), or spaced so they don't overlap.2.5.8 (AA), 2.5.5 (AAA)
MotionAnimations respect the reduced-motion setting.2.3.3 (AAA)