Skip to content
FrameworkStyle

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

PropertyTypeDetails
coreTooltipCore
tooltipfunction
stateTooltipCore.State
preferredSideTooltipCore.State['side']
setPositionedSidefunction
stateAttrMap{ [Key in keyof State]?: string; }
anchorNamestring
popupIdstring
contentobject
setContent((content: TooltipContent | function
boundary'viewport' | 'container' | string & o...
containerobject | null