UI

Hover message

Short supporting text for unfamiliar controls, shown on hover or keyboard focus.

import { Tooltip } from '@uthereal/ui/tooltip'

Tooltip playground

Loading interactive preview…

Overview

Tooltip (hover message) renders a compact inverted-ink bubble when a user hovers a trigger after a short delay or focuses it with the keyboard immediately. Moving between neighbouring tooltips within 300 ms skips the open delay and crossfades without travel. A safe-polygon grace corridor keeps the bubble open while the pointer travels directly between the trigger and the bubble.

Use a hover message for concise supporting detail or keyboard shortcuts (shortcut, display-only). Never place links, buttons, or the only copy of essential information inside it, because touch users may never trigger hover. Use a Hover card for rich read-only previews and a Dialog or Drawer for interactive content. Icon-only Button controls render their own tooltip by default.

Usage

Wrap a single focusable element. Its existing props, id, and event handlers are preserved.

'use client'
import { Button } from '@uthereal/ui/button'
import { Tooltip } from '@uthereal/ui/tooltip'

export function PublishButton() {
  return (
    <Tooltip content="Publishes to everyone in the workspace" shortcut="⌘⇧P">
      <Button label="Publish" action="publish" />
    </Tooltip>
  )
}

When content changes while the bubble is open (for example, "Copy link" to "Copied"), the text crossfades in place with a soft blur while the bubble springs to the new width and height.

Without a child element, the serializable trigger prop renders a Button; its icon takes a name from the icon list. renderTrigger(props, state) renders a custom focusable trigger.

Examples

Placement and shortcuts

top is the default placement shown in the playground above. Set placement to right, bottom, or left (collision detection flips automatically when viewport room runs short), and pass shortcut to append a display-only key cap.

Timing and warm handoff

EventTimingBehavior
Cold hoveropenDelay (250 ms)Waits before opening; rises 3 px from scale 0.97 over 160 ms.
Warm handoff0 ms inside 300 ms skip windowWhile any tooltip is open or closed within 300 ms, the next opens immediately and fades in over 120 ms without travel.
Keyboard focusImmediateOpens as soon as the trigger receives keyboard focus.
Pointer leavecloseDelay (0 ms)Stays open inside the trigger-to-bubble grace hull; otherwise exits to scale 0.98 over 120 ms.
Press, scroll, EscapeImmediateDismisses the bubble immediately.

Controlled state

Omit open to let the tooltip manage visibility internally, or control it with open and onOpenChange. onOpenChange fires in both modes.

API reference

Serializable arguments and defaults come directly from tooltipConfigSchema.

ArgumentType / defaultDescription
contentRequiredstring—The hint, required. One short sentence that adds to the trigger’s name, e.g. "Visible to everyone in the workspace".
shortcutstring—A keyboard shortcut shown after the hint in muted text, e.g. "⌘B". Display only: the application binds the key.
placementPlacementDefault: "top"Preferred side of the trigger. Collision detection flips it when there is no room.
openDelayintegerDefault: 250Hover time before the tooltip opens, in milliseconds. Keyboard focus opens it at once, and moving between tooltips skips the delay.
closeDelayintegerDefault: 0Time before the tooltip closes after the pointer leaves, in milliseconds; 0 by default, as in Arc.
triggerOverlayTriggerDefault: {"label":"More information","variant":"outline","tone":"neutral","size":"md"}The button that shows the tooltip when no React trigger is supplied: label, optional icon, variant, tone and size.
defaultOpenbooleanDefault: falseInitial open state. Later argument edits do not reset an existing instance.
recipestudio | softDefault: "studio"Visual treatment. Both recipes use the same interaction behavior.
themeTooltipTheme—Color mode, accent, and tokens for the bubble. See Theming for all keys and defaults.
motionnone | subtle | expressiveDefault: "subtle"Popup animation preset. System reduced-motion preferences take precedence.
motionOptionsTooltipMotionOptions—Popup transition, and entrance and exit poses. Exits run faster than entrances. Durations are milliseconds.
dirltr | rtl—Reading direction. Omit it to inherit the page direction.

React integration

PropPurpose
childrenSingle focusable trigger element; its props, id, and handlers are preserved.
renderTrigger(props, state)Renders a custom focusable trigger; spread all supplied props.
open, onOpenChange(open)Controlled open state and change callback.
describeTriggerSet false when content duplicates the trigger's accessible name so assistive technology does not announce it twice.
presetApplication defaults merged below instance props.
renderIcon(name, context)Replaces the default trigger icon (slot: 'trigger'). Keep decorative.
tokens--ui-* CSS variables applied after the typed theme on the trigger and bubble.
classNameAdded to the portalled bubble.
portalContainerMount target for nesting inside a native modal top layer.

Keyboard & accessibility

KeyInteraction
TabFocusing the trigger opens the hover message immediately.
EscapeDismisses the hover message while keeping focus on the trigger.

The bubble renders with role="tooltip" and wires to its trigger via aria-describedby while open. When content repeats the trigger's aria-label (such as an icon-only control), pass describeTrigger={false} so the bubble stays visual-only (aria-hidden="true"). Disabled buttons do not fire focus or hover events; keep triggers focusable or explain disabled states in visible text.

Placement and horizontal alignment adapt to dir="rtl". Under forced-colors: active, the bubble draws a 1 px solid ButtonText border.

Motion and theming

A cold bubble rises 3 px vertically from scale 0.97 over 160 ms (dropping downward when placed on bottom, rising upward on every other side) and exits in place to scale 0.98 over 120 ms. Warm handoffs skip travel and scale, fading over 120 ms. Dynamic content swaps rise 0.3em out of a soft blur while a ResizeObserver springs the bubble dimensions with motionTokens.spring.morph.

motionOptions customizes popup transition, enter, and exit poses (durations in ms). Setting motion="none" removes all transitions (0 ms) and snaps content changes immediately. Under prefers-reduced-motion: reduce, travel, scale, blur, and size springs stop while the bubble keeps a 120 ms opacity crossfade.

The bubble uses inverted ink colors: --ui-text background, --ui-tooltip-background text (--ui-surface in light mode, #141414 in dark mode), a 14% edge border mix, 12 px 16 px padding, and maxWidth (240 px, viewport-clamped). theme accepts mode, accent, surface, foreground, radius, shadowRaised, fontFamily, fontSize, maxWidth, and background.

Composition

In agent compositions, Tooltip is a leaf whose trigger comes from trigger.

{
  "type": "Tooltip",
  "props": {
    "content": "Visible to everyone in the workspace",
    "shortcut": "⌘⇧S",
    "trigger": { "label": "Workspace access", "icon": "globe" }
  },
  "children": []
}

On this page