1. framework components
  2. tooltip

Tooltip

A floating label that appears on hover or focus, providing additional context.

Arrow

You may optionally enable arrows via the Arrow and ArrowTip component parts. Note that Zag.js opts to style these with CSS custom properties, which can be adjusted using a style attribute.

Z-Index

Sibling (10)

Headless

Provider Pattern

Use the Provider Pattern to programmatically open and close the tooltip.

Direction

API Reference

Root

PropDefaultType
dir"ltr""ltr" | "rtl" | undefined

The document's text/writing direction.

aria-labelstring | undefined

Custom label for the tooltip.

idsPartial<{ trigger: string; content: string; arrow: string; positioner: string; }> | undefined

The ids of the elements in the tooltip. Useful for composition.

openDelay400number | undefined

The open delay of the tooltip.

closeDelay150number | undefined

The close delay of the tooltip.

closeOnPointerDowntrueboolean | undefined

Whether to close the tooltip on pointerdown.

closeOnEscapetrueboolean | undefined

Whether to close the tooltip when the Escape key is pressed.

closeOnScrolltrueboolean | undefined

Whether the tooltip should close on scroll

closeOnClicktrueboolean | undefined

Whether the tooltip should close on click

interactivefalseboolean | undefined

Whether the tooltip's content is interactive. In this mode, the tooltip will remain open when user hovers over the content.

onOpenChange((details: OpenChangeDetails) => void) | undefined

Function called when the tooltip is opened.

positioningPositioningOptions | undefined

The user provided options used to position the popover content

disabledboolean | undefined

Whether the tooltip is disabled

openboolean | undefined

The controlled open state of the tooltip

defaultOpenboolean | undefined

The initial open state of the tooltip when rendered. Use when you don't need to control the open state of the tooltip.

getRootNode(() => Node | ShadowRoot | Document) | undefined

A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron.

childrenSnippet<[]> | undefined

The default slot content to be rendered within the component.

Provider

PropDefaultType
value() => TooltipApi<PropTypes>

childrenSnippet<[]> | undefined

The default slot content to be rendered within the component.

Context

PropDefaultType
childrenSnippet<[() => TooltipApi<PropTypes>]>

Trigger

PropDefaultType
elementSnippet<[HTMLAttributes<"button">]> | undefined

Render the element yourself

Positioner

PropDefaultType
elementSnippet<[HTMLAttributes<"div">]> | undefined

Render the element yourself

Content

PropDefaultType
elementSnippet<[HTMLAttributes<"div">]> | undefined

Render the element yourself

Arrow

PropDefaultType
elementSnippet<[HTMLAttributes<"div">]> | undefined

Render the element yourself

ArrowTip

PropDefaultType
elementSnippet<[HTMLAttributes<"div">]> | undefined

Render the element yourself

View page on GitHub