Skip to main content
For development, import Tooltip from @servicetitan/anvil2. For design, find it in the Anvil2 file.

Anatomy

The Tooltip consists of three primary elements that work together to add quick clarity to an element.
Anatomy of a
Tooltip
  1. Tooltip background, content
  2. Caret
  3. Trigger

Options

The Tooltip supports the following configurations to accommodate various supplementary information scenarios.

Content

Text content

Tooltip options
text
By default, Tooltips support a basic string of text, with only minimal additions that can be added, such as emojis.

Custom content

Text options custom
content
Content within the Tooltip can be customized beyond text, but only with non-interactive elements.

Placement

Tooltip options
placement
Tooltip placement adjusts automatically when insufficient space is available. See behaviors for details.

Visual States

Tooltips open when the trigger element is in a hover or focus state. Avoid removing opening on focus, as this prevents keyboard-only users from viewing Tooltips.
Tooltip visual
states
A Tooltip appearing on both the hover and focus state of a Button.

Behavior

The Tooltip responds to space constraints with automatic positioning adjustments and overflow handling.

Overflow handling

Tooltip behavior overflow
handling
Text in a Tooltip will wrap. The max-width of a Tooltip is 272px or 17rem, while the text region is 256px or 16rem.

Usage Guidelines

Alternatives

Tooltips are generally difficult to both discover and use on the page, particularly for touch device users. Explore alternatives to a Tooltip first, such as inline text.

Tooltip vs Popover

Tooltip is the component of choice for tips and other informational overlays. Popovers may be used in place of a Tooltip when actions are needed.

Content

Content within the Tooltip should be brief, clear, and supplementary to the trigger element.

Keep content 1-2 lines

When content extends to 3+ lines, it is strongly encouraged to find another method of conveying the information.
Tooltip content short
do
Do
Tooltip content short
don't
Don’t

Don’t repeat the content of the Tooltip’s trigger

Avoid repeating the trigger’s content in the Tooltip, even in UIs that heavily use Tooltips. Omitting a redundant Tooltip is preferred over consistent Tooltip usage in the UI.
Tooltip content repeat
don't
Don’t

Keyboard Interaction

Users can navigate the Tooltip using standard keyboard controls.

Accessibility

Anvil provides accessibility needs out of the box. Annotating labels is the main piece needed in a design.

Provide Tooltip labels for Icon Buttons

Provide a label to describe the action for both screen readers and users who focus on the element, regardless of whether a label is visible on the page. For more guidance on labels and context, see input field context association best practices.

Code

Common Examples

The Tooltip component is used to add a floating label to an element, usually triggered on hover or focus.

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 October 27, 2026