Skip to main content

Common Examples

The Tooltip component is used to add a floating label to an element, usually triggered on hover or focus.
import { Tooltip } from "@servicetitan/anvil2";

function ExampleComponent() {
  return (
    <Tooltip>
      <Tooltip.Trigger>
        <span>Hover to open</span>
      </Tooltip.Trigger>
      <Tooltip.Content>Tooltip Content</Tooltip.Content>
    </Tooltip>
  );
}

Controlling tooltip state

By default, the open state of a tooltip is managed internally and opens when the trigger element has hover or focus.To manually control the open state of the tooltip, use the open prop.

Adjusting tooltip offset

In some cases, the context around the tooltip trigger may require the tooltip to render further away from or closer to the trigger.In these cases, adjust the offset prop, which accepts a number representing pixels.
Last modified on January 23, 2026