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 getsaria-describedbyonly while it is shown. - Shows on hover (after
hoverDelay) and keyboard focus; hides on pointer leave, blur, click and Escape. disableFocusTriggerstops it opening on focus — only use it when the hint is available another way.closableadds a close button labelled bycloseLabel.
API
Tooltip
Short hint shown on hover and focus of its anchor. Not for essential content.
| Prop | Type | Default | Description |
|---|---|---|---|
| children (required) | ReactElement<unknown, string | JSXElementConstructor<any>> | — | The anchor: one element that can hold a ref and receive focus. |
| appearance | TooltipAppearance | neutral | |
| className | string | — | |
| closable | boolean | false | Show a close button (implies `interactive`). |
| closeLabel | string | Close | |
| defaultOpen | boolean | false | |
| description | ReactNode | — | |
| disableFocusTrigger | boolean | false | Do not open when the anchor receives keyboard focus. |
| hideArrow | boolean | false | |
| hoverDelay | number | 150 | Delay before showing on hover, in ms. |
| interactive | boolean | false | Keep the tooltip open while the pointer is over it, so it can hold links or a close button. |
| maxWidth | string | number | 220px token | Max width as a CSS length. |
| offset | number | 8 | Distance from the anchor in px. |
| onOpenChange | ((open: boolean) => void) | — | |
| open | boolean | — | |
| placement | Placement | bottom | |
| title | ReactNode | — |