Skip to content

Tooltip ​

A short text hint for a control, shown on hover and keyboard focus: the name of an icon button, or a shortcut. Use popover for content people interact with, and visible text for anything they must read.

Usage ​

vue
<!-- Once, at the app root. -->
<TooltipProvider>
  <App />
</TooltipProvider>

<Tooltip>
  <TooltipTrigger as-child>
    <Button variant="ghost" aria-label="Archive"><Icon name="close" /></Button>
  </TooltipTrigger>
  <TooltipContent>Archive</TooltipContent>
</Tooltip>

Props ​

PartPropTypeDefaultNotes
TooltipProviderdelayDurationnumber700Milliseconds of hover before a tooltip opens
TooltipProviderskipDelayDurationnumber300Moving to another trigger within this time opens it at once
TooltipProviderignoreNonKeyboardFocusbooleantrueOnly keyboard focus opens a tooltip; false lets any focus open it
Tooltipopenbooleannonev-model:open
TooltipdelayDurationnumbernoneOverrides the provider's for this tooltip
TooltipTriggerasChildbooleanfalseMerge onto the child, such as a Button
TooltipTriggerasAsTag | ComponentnoneElement to render; Reka renders a button
TooltipContentside'top' | 'right' | 'bottom' | 'left''top'Flips when there is no room

TooltipContent takes class, merged last. TooltipProvider and Tooltip render no element of their own.

Slots ​

PartSlotContent
TooltipProviderdefaultThe app
TooltipdefaultThe trigger and the content
TooltipTriggerdefaultThe control the tooltip describes
TooltipContentdefaultThe hint text

Events ​

PartEventPayloadWhen
Tooltipupdate:openboolean | undefinedThe tooltip opens or closes

Tokens ​

None of its own. The tooltip inverts the page colours (foreground behind background text), at z-tooltip, corners radius-sm.

States ​

closed; open on hover after the delay; open on keyboard focus; each side; text that wraps at the maximum width.

Keyboard ​

KeyAction
TabFocusing the trigger opens the tooltip at once
EscapeCloses the tooltip; focus stays on the trigger

Accessibility ​

  • The content has role="tooltip"; the trigger's aria-describedby points at it while open.
  • A tooltip only describes. Give an icon-only trigger its own accessible name (aria-label); the tooltip doesn't name it.
  • Never put links, buttons or other interactive content in a tooltip.
  • Only keyboard focus opens a tooltip. Focus moved by script after a mouse action (a menu closing on a click) doesn't, so tooltips don't pop up unasked.
  • A TooltipTrigger that renders its own button is type="button", so it never submits a form. With as-child, give a plain <button> child type="button" yourself (the Button component already does).

Do ​

vue
<Tooltip>
  <TooltipTrigger as-child>
    <Button variant="ghost" aria-label="Search"><Icon name="search" /></Button>
  </TooltipTrigger>
  <TooltipContent>Search (/)</TooltipContent>
</Tooltip>

Do not ​

vue
<!-- A tooltip as the only label of an icon button: it isn't its name. -->
<Tooltip>
  <TooltipTrigger as-child><Button variant="ghost"><Icon name="search" /></Button></TooltipTrigger>
  <TooltipContent>Search</TooltipContent>
</Tooltip>