Tooltip

A small floating text label that appears next to its trigger on hover or keyboard focus. Never contains interactive content.

Installation

npx dafink-ui add tooltip

Demo

Props

NameTypeDefaultDescription
contentReactNode-The tooltip text. Must be non-interactive content only.
childrenReactElement-A single trigger element; receives hover/focus handlers and aria-describedby automatically.
side'top' | 'right' | 'bottom' | 'left''top'Which side of the trigger the tooltip appears on.
delaynumber300Open delay in milliseconds for hover. Keyboard focus shows the tooltip immediately.
classNamestring''Additional classes on the wrapper span.

Accessibility

Tooltip never receives or manages focus itself — the trigger keeps native focus throughout, gains aria-describedby pointing at the tooltip while it's shown, and the tooltip element carries role="tooltip". It shows on hover (after `delay`ms) and on keyboard focus (immediately, no delay), and must never contain interactive content.

KeyFunction
tabMoves native focus to the trigger, which shows the tooltip immediately (no delay).
shift+tabMoves focus off the trigger, which hides the tooltip on blur.
escapeDismisses the tooltip, whether it was shown by hover or focus.