Duolith docs

Tooltip

A short description of the control it wraps, shown on hover and focus after a moment.

Stability: experimental

Props

PropTypeDefaultMeans
textstringThe description, a few words long.
placement"top" | "bottom" | "left" | "right"topWhich side of the control it prefers. It flips to the opposite side when there is no room.

Children

The control it describes, such as an IconButton.

States

StateLooks like
hiddenNot shown; the control is still described by the text.
shownCaption text in the surface colour on an ink background, a small radius, 6px from the control; fades in over 120 ms (at once with reduced motion).

Accessibility

roletooltip
nameIts text.
focusNever takes focus. It shows 500 ms after the control is hovered or focused, and hides when the pointer or focus leaves.
keyboardEscape hides it, leaving focus where it is.
notesThe control is described by the tooltip (aria-describedby) whether it shows or not, so its text is never lost to a screen reader.

Theme tokens

color.ink color.surface shadow.md radius.sm space.1 space.2 text.caption

Example

<Tooltip text="Add to favourites"><IconButton icon="star" label="Favourite" /></Tooltip>