Tooltip
Anchored tooltip that sits centred on its trigger. It appears after a short hover or straight away on keyboard focus, closes on Escape, and is linked with aria-describedby. It shares the overlay engine with Popover and Menu, so a clipped card cannot cut it off and it flips below when there is no room. The border takes the Prism colour of where the trigger sits on the page.
- aria-describedby
- Popover API
- CSS anchor positioning
- pastelColour
Hover a tool, or press Tab to move through them. Escape hides the tooltip.
Usage
Drop it in
import { Tooltip } from "@/app/lib/components/tooltip";<Tooltip content="Undo (⌘Z)">
<IconButton aria-label="Undo"><Undo2 size={15} /></IconButton>
</Tooltip>API
Props
| Prop | Type | Default |
|---|---|---|
content*What the tooltip says. Keep it short: a label or a shortcut. | ReactNode | — |
children*The element it describes. A single element gets `aria-describedby` directly. | ReactNode | — |
sideWhich side of the trigger it sits on. Default: "top" | "top" | "bottom" | "top" |
delayHover delay before it appears, in ms. Keyboard focus shows it at once. Default: 300 | number | 300 |
className | string | "" |
Read from the component's source at build time. * required.
Accessibility
Works with
- Cursor
- Reacts to where the pointer is, not just whether it's over the element.
- Touch
- Follows your finger while it's down, then settles a moment after you lift.
- Keyboard
- Focus lights it up the way the cursor does. Every action has a key.
- Reduced motion
- Nothing moves or springs. Colour still answers, without drifting.