useTooltipContext
Hook to access the nearest Tooltip compound-component context
Import
import { useTooltipContext } from "@videojs/react";Usage
Use this hook to build a custom part rendered inside Tooltip.Root.
function CloseTooltipButton() {
const { tooltip } = useTooltipContext();
return <button onClick={() => tooltip.close()}>Close tooltip</button>;
}The hook throws when there is no surrounding Tooltip.Root.
API Reference
Return Value
| Property | Type | Details |
|---|---|---|
core | TooltipCore | |
tooltip | function | |
| ||
state | TooltipCore.State | |
preferredSide | TooltipCore.State['side'] | |
setPositionedSide | function | |
| ||
stateAttrMap | { [Key in keyof State]?: string; } | |
anchorName | string | |
popupId | string | |
content | object | |
| ||
setContent | ((content: TooltipContent | function | |
| ||
boundary | 'viewport' | 'container' | string & o... | |
| ||
container | object | null | |