tsimport {useTooltip} from '@astryxdesign/core/Tooltip'
| Guidance | Practices |
|---|---|
| Do | Use for brief text labels that describe icon buttons, truncated text, abbreviations, or compact controls. |
| Do | Prefer the Tooltip component for standard wrapping; use the hook when the trigger is not a simple child. |
| Don't | Put interactive content inside tooltips: use Popover or HoverCard instead. |
| Param | Type | Description |
|---|---|---|
placement | 'above' | 'below' | 'start' | 'end' (default: 'above') | Position relative to the trigger. |
alignment | 'start' | 'center' | 'end' (default: 'center') | Alignment along the placement axis. |
delay | number (default: 200) | Delay before showing on hover, in milliseconds. |
hideDelay | number (default: 0) | Delay before hiding after mouse or focus leaves, in milliseconds. |
focusTrigger | 'auto' | 'always' | 'never' (default: 'auto') | When focus should open the tooltip. auto only attaches focus listeners to naturally focusable elements. |
isEnabled | boolean (default: true) | Whether hover and focus triggers are enabled. |
isOpen | boolean | Controlled open state. true force-shows, false force-hides, undefined lets hover/focus manage visibility. |
isDefaultOpen | boolean (default: false) | Whether the tooltip should be shown on mount. |
onShow | () => void | Callback fired when the tooltip becomes visible. |
onHide | () => void | Callback fired when the tooltip is hidden. |
| Field | Type | Description |
|---|---|---|
| ref | RefCallback<HTMLElement> | Combined ref that sets both position and interaction on the same trigger element. |
| positionRef | RefCallback<HTMLElement> | Ref for the positioning anchor element. |
| interactionRef | RefCallback<HTMLElement> | Ref for the hover/focus interaction element. |
| anchorId | string | CSS anchor name for advanced positioning cases. |
| describedBy | string | ID to compose into aria-describedby on the trigger. |
| renderTooltip | (children: ReactNode, props?: ContextRenderProps) => ReactNode | Render function for the anchor-positioned tooltip content. |