datui
Color scheme

Overlays

Tooltip

Short hint shown on hover and focus of its anchor. Not for essential content.

import { Tooltip } from "datui";

Examples

Appearances

Title and close button

Accessibility

  • Content is exposed as role="tooltip"; the anchor gets aria-describedby only while it is shown.
  • Shows on hover (after hoverDelay) and keyboard focus; hides on pointer leave, blur, click and Escape.
  • disableFocusTrigger stops it opening on focus — only use it when the hint is available another way.
  • closable adds a close button labelled by closeLabel.

API

Tooltip

Short hint shown on hover and focus of its anchor. Not for essential content.

PropTypeDefaultDescription
children (required)ReactElement<unknown, string | JSXElementConstructor<any>>—The anchor: one element that can hold a ref and receive focus.
appearanceTooltipAppearanceneutral
classNamestring—
closablebooleanfalseShow a close button (implies `interactive`).
closeLabelstringClose
defaultOpenbooleanfalse
descriptionReactNode—
disableFocusTriggerbooleanfalseDo not open when the anchor receives keyboard focus.
hideArrowbooleanfalse
hoverDelaynumber150Delay before showing on hover, in ms.
interactivebooleanfalseKeep the tooltip open while the pointer is over it, so it can hold links or a close button.
maxWidthstring | number220px tokenMax width as a CSS length.
offsetnumber8Distance from the anchor in px.
onOpenChange((open: boolean) => void)—
openboolean—
placementPlacementbottom
titleReactNode—