Hover message
Short supporting text for unfamiliar controls, shown on hover or keyboard focus.
import { Tooltip } from '@uthereal/ui/tooltip'Tooltip playground
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
| Event | Timing | Behavior |
|---|---|---|
| Cold hover | openDelay (250 ms) | Waits before opening; rises 3 px from scale 0.97 over 160 ms. |
| Warm handoff | 0 ms inside 300 ms skip window | While any tooltip is open or closed within 300 ms, the next opens immediately and fades in over 120 ms without travel. |
| Keyboard focus | Immediate | Opens as soon as the trigger receives keyboard focus. |
| Pointer leave | closeDelay (0 ms) | Stays open inside the trigger-to-bubble grace hull; otherwise exits to scale 0.98 over 120 ms. |
Press, scroll, Escape | Immediate | Dismisses 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.
| Argument | Type / default | Description |
|---|---|---|
contentRequired | string— | The hint, required. One short sentence that adds to the trigger’s name, e.g. "Visible to everyone in the workspace". |
shortcut | string— | A keyboard shortcut shown after the hint in muted text, e.g. "⌘B". Display only: the application binds the key. |
placement | PlacementDefault: "top" | Preferred side of the trigger. Collision detection flips it when there is no room. |
openDelay | integerDefault: 250 | Hover time before the tooltip opens, in milliseconds. Keyboard focus opens it at once, and moving between tooltips skips the delay. |
closeDelay | integerDefault: 0 | Time before the tooltip closes after the pointer leaves, in milliseconds; 0 by default, as in Arc. |
trigger | OverlayTriggerDefault: {"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. |
defaultOpen | booleanDefault: false | Initial open state. Later argument edits do not reset an existing instance. |
recipe | studio | softDefault: "studio" | Visual treatment. Both recipes use the same interaction behavior. |
theme | TooltipTheme— | Color mode, accent, and tokens for the bubble. See Theming for all keys and defaults. |
motion | none | subtle | expressiveDefault: "subtle" | Popup animation preset. System reduced-motion preferences take precedence. |
motionOptions | TooltipMotionOptions— | Popup transition, and entrance and exit poses. Exits run faster than entrances. Durations are milliseconds. |
dir | ltr | rtl— | Reading direction. Omit it to inherit the page direction. |
React integration
| Prop | Purpose |
|---|---|
children | Single 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. |
describeTrigger | Set false when content duplicates the trigger's accessible name so assistive technology does not announce it twice. |
preset | Application 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. |
className | Added to the portalled bubble. |
portalContainer | Mount target for nesting inside a native modal top layer. |
Keyboard & accessibility
| Key | Interaction |
|---|---|
Tab | Focusing the trigger opens the hover message immediately. |
Escape | Dismisses 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": []
}