useTooltipTriggerState

Manages state for a tooltip trigger. Tracks whether the tooltip is open, and provides methods to toggle this state. Ensures only one tooltip is open at a time and controls the delay for showing a tooltip.

installyarn add @react-stately/tooltip
version3.0.9
usageimport {useTooltipTriggerState} from '@react-stately/tooltip'

API#


useTooltipTriggerState( (props: TooltipTriggerProps )): TooltipTriggerState

Interface#


Properties

NameTypeDescription
isOpenbooleanWhether the tooltip is currently showing.

Methods

MethodDescription
open( (immediate?: boolean )): void

Shows the tooltip. By default, the tooltip becomes visible after a delay depending on a global warmup timer. The immediate option shows the tooltip immediately instead.

close( (immediate?: boolean )): voidHides the tooltip.

Example#


See the docs for useTooltipTrigger in react-aria for an example of useTooltipTriggerState.