Skip to content

Interface: Tooltip ​

Controller returned by createTooltip().

Methods ​

getState() ​

ts
getState(): TooltipState;

The current state; the same object until something changes.

Returns ​

TooltipState


getTooltipProps() ​

ts
getTooltipProps(id): ElementProps;

Props for the tooltip of id: id, role="tooltip", aria-hidden, data-state (open/closed).

Parameters ​

ParameterType
idstring

Returns ​

ElementProps


getTriggerProps() ​

ts
getTriggerProps(id, options?): ElementProps;

Props for a trigger: shows its tooltip on hover (not touch) and focus after the delay, hides on pointer leave, blur and mousedown. Adds aria-describedby only with describe.

Parameters ​

ParameterType
idstring
options?TooltipTriggerOptions

Returns ​

ElementProps


hide() ​

ts
hide(): void;

Hide the visible tooltip at once.

Returns ​

void


show() ​

ts
show(id): void;

Show the tooltip for id at once, without the delay.

Parameters ​

ParameterType
idstring

Returns ​

void


subscribe() ​

ts
subscribe(listener): () => void;

Call listener on every state change; returns the unsubscribe function.

Parameters ​

ParameterType
listener() => void

Returns ​

() => void