# Tooltip (/cloud/headless/tooltip)



{/* Generated by scripts/sync-base-ui-reference.mjs. Edit the script, not this file. */}

## In Nyte [#in-nyte]

```ts title="Import"
import { Tooltip } from "@nyte-ai/ui/tooltip";
```

`@nyte-ai/ui/tooltip` re-exports the Base UI namespace unchanged. There is no Nyte styling on
this subpath; the consumer owns every class, StyleX style, and layout decision. Base UI owns the
interaction model, keyboard handling, focus management, and ARIA below.

Consumed by:

* `desktop/src/renderer/src/components/ui.tsx`
* `desktop/src/renderer/src/router.tsx`

The rest of this page is Base UI's documentation for `@base-ui/react/tooltip`, reproduced
verbatim under the MIT license, © Material-UI SAS. Component paths in examples refer to the Base UI
package; in Nyte, import from the subpath above.

## Usage guidelines [#usage-guidelines]

* **Prefer using tooltips as visual labels only**: Tooltips should act as supplementary visual labels for sighted mouse and keyboard users. Tooltips alone are not accessible to touch or screen reader users. See [Alternatives to tooltips](#alternatives-to-tooltips) for more details.
* **Provide an accessible name for the trigger**: Tooltips are visual-only elements and are not a replacement for labeling the trigger. The tooltip's trigger must have an `aria-label` attribute that closely matches the tooltip's content to ensure consistency for screen reader users.

## Anatomy [#anatomy]

Import the component and assemble its parts:

```jsx title="Anatomy"
import { Tooltip } from '@base-ui/react/tooltip';

<Tooltip.Provider>
  <Tooltip.Root>
    <Tooltip.Trigger />
    <Tooltip.Portal>
      <Tooltip.Positioner>
        <Tooltip.Popup>
          <Tooltip.Arrow />
          <Tooltip.Viewport />
        </Tooltip.Popup>
      </Tooltip.Positioner>
    </Tooltip.Portal>
  </Tooltip.Root>
</Tooltip.Provider>;
```

## Alternatives to tooltips [#alternatives-to-tooltips]

Tooltips should be supplementary popups that provide non-essential clarity in high-density UIs. A user should not miss critical information if they never see a tooltip.

Tooltips don't work well with touch input. Unlike mouse pointers with hover capability, there's no easily discoverable way to reveal a tooltip before tapping its trigger on a touch device.

iOS doesn't provide a system-standard, touch-friendly tooltip affordance, while Android may show a tooltip on long press. However, on the web, long press is often used to trigger contextual menus in the browser, which can lead to potential conflicts. For this reason, tooltips are disabled on touch devices.

### Infotips [#infotips]

Popups that open when hovering an info icon should use [Popover](/react/components/popover) with the `openOnHover` prop on the trigger instead of a tooltip. This way, touch users and screen reader users can access the content.

To know when to reach for a popover instead of a tooltip, consider the **purpose** of the trigger element:
If the trigger's purpose is to open the popup itself, it's a popover. If the trigger's purpose is unrelated to opening the popup, it's a tooltip.

### Description text [#description-text]

Tooltips are designed for sighted users and are not a reliable way to deliver important information to touch users or assistive technologies. If the description is important to understanding the element, don't hide it behind a tooltip — use inline text or [Popover](/react/components/popover) if space is limited, so the information is accessible to everyone.

Since tooltips serve sighted mouse and keyboard users, iconography should clearly communicate the purpose of icon-only triggers, especially on mobile where the text label may not be visible.

If the description is not critical, a tooltip can still be used to provide extra clarity for sighted mouse or keyboard users.

### Contextual feedback messages [#contextual-feedback-messages]

Use the Toast component's [anchoring ability](/react/components/toast#anchored-toasts) for more ergonomic DX, to ensure the message is announced to screen readers, and to support complex content.

## Examples [#examples]

### Detached triggers [#detached-triggers]

A tooltip can be controlled by a trigger located either inside or outside the `<Tooltip.Root>` component.
For simple, one-off interactions, place the `<Tooltip.Trigger>` inside `<Tooltip.Root>`, as shown in the example at the top of this page.

However, if defining the tooltip's content next to its trigger is not practical, you can use a detached trigger.
This involves placing the `<Tooltip.Trigger>` outside of `<Tooltip.Root>` and linking them with a `handle` created by the `Tooltip.createHandle()` function.

The imperative methods on the handle, such as `open()` and `close()`, require a `<Tooltip.Root>` using the same handle to be mounted.
Calls made while no root is attached to the handle — before one mounts, or after it unmounts — are ignored. Each time a root mounts, it starts from fresh state: a call made while no root was attached is not replayed, and no open state carries over from a previous mount.

```jsx title="Detached triggers"
const demoTooltip = Tooltip.createHandle();

// @highlight
// @highlight-text "handle={demoTooltip}"
<Tooltip.Trigger handle={demoTooltip}>Button</Tooltip.Trigger>

// @highlight
// @highlight-text "handle={demoTooltip}"
<Tooltip.Root handle={demoTooltip}>
  ...
</Tooltip.Root>
```

### Multiple triggers [#multiple-triggers]

A single tooltip can be opened by multiple trigger elements.
You can achieve this by using the same `handle` for several detached triggers, or by placing multiple `<Tooltip.Trigger>` components inside a single `<Tooltip.Root>`.

```jsx title="Multiple triggers within the Root part"
<Tooltip.Root>
  <Tooltip.Trigger>Trigger 1</Tooltip.Trigger>
  <Tooltip.Trigger>Trigger 2</Tooltip.Trigger>
  ...
</Tooltip.Root>
```

```jsx title="Multiple detached triggers"
const demoTooltip = Tooltip.createHandle();

<Tooltip.Trigger handle={demoTooltip}>
  Trigger 1
</Tooltip.Trigger>

<Tooltip.Trigger handle={demoTooltip}>
  Trigger 2
</Tooltip.Trigger>

<Tooltip.Root handle={demoTooltip}>
  ...
</Tooltip.Root>
```

The tooltip can render different content depending on which trigger opened it.
This is achieved by passing a `payload` to the `<Tooltip.Trigger>` and using the function-as-a-child pattern in `<Tooltip.Root>`.

The payload can be strongly typed by providing a type argument to the `createHandle()` function:

```jsx title="Detached triggers with payload"
// @highlight
const demoTooltip = Tooltip.createHandle<{ text: string }>();

// @highlight
// @highlight-text "payload"
<Tooltip.Trigger handle={demoTooltip} payload={{ text: 'Trigger 1' }}>
  Trigger 1
</Tooltip.Trigger>

// @highlight
// @highlight-text "payload"
<Tooltip.Trigger handle={demoTooltip} payload={{ text: 'Trigger 2' }}>
  Trigger 2
</Tooltip.Trigger>

<Tooltip.Root handle={demoTooltip}>
  {({ payload }) => ( // @highlight-text "payload"
    <Tooltip.Portal>
      <Tooltip.Positioner sideOffset={8}>
        <Tooltip.Popup className={styles.Popup}>
          <Tooltip.Arrow className={styles.Arrow}>
            <ArrowSvg />
          </Tooltip.Arrow>
          {payload !== undefined && ( {/* @highlight-text "payload" */}
            <span>
              Tooltip opened by {payload.text} {/* @highlight-text "payload" */}
            </span>
          )}
        </Tooltip.Popup>
      </Tooltip.Positioner>
    </Tooltip.Portal>
  )}
</Tooltip.Root>
```

### Controlled mode with multiple triggers [#controlled-mode-with-multiple-triggers]

You can control the tooltip's open state externally using the `open` and `onOpenChange` props on `<Tooltip.Root>`.
This allows you to manage the tooltip's visibility based on your application's state.
When using multiple triggers, you have to manage which trigger is active with the `triggerId` prop on `<Tooltip.Root>` and the `id` prop on each `<Tooltip.Trigger>`.

Note that there is no separate `onTriggerIdChange` prop.
Instead, the `onOpenChange` callback receives an additional argument, `eventDetails`, which contains the trigger element that initiated the state change.

### Animating the Tooltip [#animating-the-tooltip]

You can animate a tooltip as it moves between different trigger elements.
This includes animating its position, size, and content.

#### Position and Size [#position-and-size]

To animate the tooltip's position, apply CSS transitions to the `left`, `right`, `top`, and `bottom` properties of the **Positioner** part.
To animate its size, transition the `width` and `height` of the **Popup** part.

#### Content [#content]

The tooltip also supports content transitions.
This is useful when different triggers display different content within the same tooltip.

To enable content animations, wrap the content in the `<Tooltip.Viewport>` part.
This part provides features to create direction-aware animations.
It renders a `div` with a `data-activation-direction` attribute that indicates the new trigger's position relative to the previous one. The value is a space-separated set of up to two tokens (one per axis) — `left` or `right` for the horizontal axis and `up` or `down` for the vertical axis (for example, `right down`). Match a single token with the `~=` attribute selector, such as `[data-activation-direction~='right']`.

Inside the `<Tooltip.Viewport>`, the content is further wrapped in `div`s with data attributes to help with styling:

* `data-current`: The currently visible content when no transitions are present or the incoming content.
* `data-previous`: The outgoing content during a transition.

You can use these attributes to style the enter and exit animations.

## API reference [#api-reference]

### Root [#root]

Groups all parts of the tooltip.
Doesn't render its own HTML element.

**Root Props:**

| Prop                  | Type                                                                       | Default  | Description                                                                                                                                                                                                                                                         |
| :-------------------- | :------------------------------------------------------------------------- | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| defaultOpen           | `boolean`                                                                  | `false`  | Whether the tooltip is initially open. To render a controlled tooltip, use the `open` prop instead.                                                                                                                                                                 |
| open                  | `boolean`                                                                  | -        | Whether the tooltip is currently open.                                                                                                                                                                                                                              |
| onOpenChange          | `((open: boolean, eventDetails: Tooltip.Root.ChangeEventDetails) => void)` | -        | Event handler called when the tooltip is opened or closed.                                                                                                                                                                                                          |
| actionsRef            | `React.RefObject<Tooltip.Root.Actions \| null>`                            | -        | A ref to imperative actions. `unmount`: Unmounts the tooltip popup.`close`: Closes the tooltip imperatively when called.                                                                                                                                            |
| defaultTriggerId      | `string \| null`                                                           | -        | ID of the trigger that the tooltip is associated with.&#xA;This is useful in conjunction with the `defaultOpen` prop to create an initially open tooltip.                                                                                                           |
| handle                | `Tooltip.Handle<Payload>`                                                  | -        | A handle to associate the tooltip with a trigger.&#xA;If specified, allows external triggers to control the tooltip's open state.&#xA;Can be created with the Tooltip.createHandle() method.                                                                        |
| onOpenChangeComplete  | `((open: boolean) => void)`                                                | -        | Event handler called after any animations complete when the tooltip is opened or closed.                                                                                                                                                                            |
| triggerId             | `string \| null`                                                           | -        | ID of the trigger that the tooltip is associated with.&#xA;This is useful in conjunction with the `open` prop to create a controlled tooltip.&#xA;There's no need to specify this prop when the tooltip is uncontrolled (that is, when the `open` prop is not set). |
| trackCursorAxis       | `'none' \| 'x' \| 'y' \| 'both'`                                           | `'none'` | Determines which axis the tooltip should track the cursor on.                                                                                                                                                                                                       |
| disabled              | `boolean`                                                                  | `false`  | Whether the tooltip is disabled.                                                                                                                                                                                                                                    |
| disableHoverablePopup | `boolean`                                                                  | `false`  | Whether the tooltip contents can be hovered without closing the tooltip.                                                                                                                                                                                            |
| children              | `React.ReactNode \| PayloadChildRenderFunction<Payload>`                   | -        | The content of the tooltip.&#xA;This can be a regular React node or a render function that receives the `payload` of the active trigger.                                                                                                                            |

### Root.Props [#rootprops]

Re-export of [Root](#root) props.

### Root.State [#rootstate]

```typescript
type TooltipRootState = {};
```

### Root.Actions [#rootactions]

```typescript
type TooltipRootActions = { unmount: () => void; close: () => void };
```

### Root.ChangeEventReason [#rootchangeeventreason]

```typescript
type TooltipRootChangeEventReason =
  | 'trigger-hover'
  | 'trigger-focus'
  | 'trigger-press'
  | 'outside-press'
  | 'escape-key'
  | 'disabled'
  | 'imperative-action'
  | 'none';
```

### Root.ChangeEventDetails [#rootchangeeventdetails]

```typescript
type TooltipRootChangeEventDetails = (
  | { reason: 'trigger-hover'; event: MouseEvent }
  | { reason: 'trigger-focus'; event: FocusEvent }
  | { reason: 'trigger-press'; event: MouseEvent | PointerEvent | TouchEvent | KeyboardEvent }
  | { reason: 'outside-press'; event: MouseEvent | PointerEvent | TouchEvent }
  | { reason: 'escape-key'; event: KeyboardEvent }
  | { reason: 'disabled'; event: Event }
  | { reason: 'imperative-action'; event: Event }
  | { reason: 'none'; event: Event }
) & {
  /** Cancels Base UI from handling the event. */
  cancel: () => void;
  /** Allows the event to propagate in cases where Base UI will stop the propagation. */
  allowPropagation: () => void;
  /** Indicates whether the event has been canceled. */
  isCanceled: boolean;
  /** Indicates whether the event is allowed to propagate. */
  isPropagationAllowed: boolean;
  /** The element that triggered the event, if applicable. */
  trigger: Element | undefined;
  preventUnmountOnClose: preventUnmountOnClose;
};
```

### Provider [#provider]

Provides a shared delay for multiple tooltips. The grouping logic ensures that
once a tooltip becomes visible, the adjacent tooltips will be shown instantly.

**Provider Props:**

| Prop       | Type              | Default | Description                                                                                                               |
| :--------- | :---------------- | :------ | :------------------------------------------------------------------------------------------------------------------------ |
| delay      | `number`          | -       | How long to wait before opening the tooltip on hover. Specified in milliseconds.                                          |
| closeDelay | `number`          | -       | How long to wait before closing a tooltip. Specified in milliseconds.                                                     |
| timeout    | `number`          | `400`   | Another tooltip will open instantly if the previous tooltip&#xA;is closed within this timeout. Specified in milliseconds. |
| children   | `React.ReactNode` | -       | -                                                                                                                         |

### Provider.Props [#providerprops]

Re-export of [Provider](#provider) props.

### Provider.State [#providerstate]

```typescript
type TooltipProviderState = {};
```

### Trigger [#trigger]

An element to attach the tooltip to.
Renders a `<button>` element.

**Trigger Props:**

| Prop         | Type                                                                                          | Default | Description                                                                                                                                                                                                                                                                                      |
| :----------- | :-------------------------------------------------------------------------------------------- | :------ | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| closeOnClick | `boolean`                                                                                     | `true`  | Whether the tooltip should close when this trigger is clicked.                                                                                                                                                                                                                                   |
| handle       | `Tooltip.Handle<Payload>`                                                                     | -       | A handle to associate the trigger with a tooltip.                                                                                                                                                                                                                                                |
| payload      | `Payload`                                                                                     | -       | A payload to pass to the tooltip when it is opened.                                                                                                                                                                                                                                              |
| disabled     | `boolean`                                                                                     | `false` | If `true`, the tooltip will not open when interacting with this trigger.&#xA;Note that this doesn't apply the `disabled` attribute to the trigger element.&#xA;If you want to disable the trigger element itself, you can pass the `disabled` prop to the trigger element via the `render` prop. |
| delay        | `number`                                                                                      | `600`   | How long to wait before opening the tooltip on hover. Specified in milliseconds.                                                                                                                                                                                                                 |
| closeDelay   | `number`                                                                                      | `0`     | How long to wait before closing the tooltip. Specified in milliseconds.                                                                                                                                                                                                                          |
| className    | `string \| ((state: Tooltip.Trigger.State) => string \| undefined)`                           | -       | CSS class applied to the element, or a function that&#xA;returns a class based on the component's state.                                                                                                                                                                                         |
| style        | `React.CSSProperties \| ((state: Tooltip.Trigger.State) => React.CSSProperties \| undefined)` | -       | Style applied to the element, or a function that&#xA;returns a style object based on the component's state.                                                                                                                                                                                      |
| render       | `ReactElement \| ((props: HTMLProps, state: Tooltip.Trigger.State) => ReactElement)`          | -       | Allows you to replace the component's HTML element&#xA;with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render.                                                                                                    |

**Trigger Data Attributes:**

| Attribute             | Type | Description                                                                                                    |
| :-------------------- | :--- | :------------------------------------------------------------------------------------------------------------- |
| data-popup-open       | -    | Present when the corresponding tooltip is open.                                                                |
| data-trigger-disabled | -    | Present when the trigger is disabled, either by the `disabled` prop or by a parent `<Tooltip.Root>` component. |

### Trigger.Props [#triggerprops]

Re-export of [Trigger](#trigger) props.

### Trigger.State [#triggerstate]

```typescript
type TooltipTriggerState = {
  /** Whether the tooltip is currently open and was opened by this trigger. */
  open: boolean;
};
```

### Portal [#portal]

A portal element that moves the popup to a different part of the DOM.
By default, the portal element is appended to `<body>`.
Renders a `<div>` element.

**Portal Props:**

| Prop        | Type                                                                                         | Default | Description                                                                                                                                                                                   |
| :---------- | :------------------------------------------------------------------------------------------- | :------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| container   | `HTMLElement \| ShadowRoot \| React.RefObject<HTMLElement \| ShadowRoot \| null> \| null`    | -       | A parent element to render the portal element into.                                                                                                                                           |
| className   | `string \| ((state: Tooltip.Portal.State) => string \| undefined)`                           | -       | CSS class applied to the element, or a function that&#xA;returns a class based on the component's state.                                                                                      |
| style       | `React.CSSProperties \| ((state: Tooltip.Portal.State) => React.CSSProperties \| undefined)` | -       | Style applied to the element, or a function that&#xA;returns a style object based on the component's state.                                                                                   |
| keepMounted | `boolean`                                                                                    | `false` | Whether to keep the portal mounted in the DOM while the popup is hidden.                                                                                                                      |
| render      | `ReactElement \| ((props: HTMLProps, state: Tooltip.Portal.State) => ReactElement)`          | -       | Allows you to replace the component's HTML element&#xA;with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |

### Portal.Props [#portalprops]

Re-export of [Portal](#portal) props.

### Portal.State [#portalstate]

```typescript
type TooltipPortalState = {};
```

### Positioner [#positioner]

Positions the tooltip against the trigger.
Renders a `<div>` element.

**Positioner Props:**

| Prop                  | Type                                                                                                                 | Default                | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| :-------------------- | :------------------------------------------------------------------------------------------------------------------- | :--------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| disableAnchorTracking | `boolean`                                                                                                            | `false`                | Whether to disable the popup from tracking any layout shift of its positioning anchor.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| align                 | `Align`                                                                                                              | `'center'`             | How to align the popup relative to the specified side.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| alignOffset           | `number \| OffsetFunction`                                                                                           | `0`                    | Additional offset along the alignment axis in pixels.&#xA;Also accepts a function that returns the offset to read the dimensions of the anchor&#xA;and positioner elements, along with its side and alignment. The function takes a `data` object parameter with the following properties: `data.anchor`: the dimensions of the anchor element with properties `width` and `height`.`data.positioner`: the dimensions of the positioner element with properties `width` and `height`.`data.side`: which side of the anchor element the positioner is aligned against.`data.align`: how the positioner is aligned relative to the specified side.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| side                  | `Side`                                                                                                               | `'top'`                | Which side of the anchor element to align the popup against.&#xA;May automatically change to avoid collisions.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| sideOffset            | `number \| OffsetFunction`                                                                                           | `0`                    | Distance between the anchor and the popup in pixels.&#xA;Also accepts a function that returns the distance to read the dimensions of the anchor&#xA;and positioner elements, along with its side and alignment. The function takes a `data` object parameter with the following properties: `data.anchor`: the dimensions of the anchor element with properties `width` and `height`.`data.positioner`: the dimensions of the positioner element with properties `width` and `height`.`data.side`: which side of the anchor element the positioner is aligned against.`data.align`: how the positioner is aligned relative to the specified side.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| arrowPadding          | `number`                                                                                                             | `5`                    | Minimum distance to maintain between the arrow and the edges of the popup. Use it to prevent the arrow element from hanging out of the rounded corners of a popup.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| anchor                | `Element \| VirtualElement \| React.RefObject<Element \| null> \| (() => Element \| VirtualElement \| null) \| null` | -                      | An element to position the popup against.&#xA;By default, the popup will be positioned against the trigger.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| collisionAvoidance    | `CollisionAvoidance`                                                                                                 | -                      | Determines how to handle collisions when positioning the popup. `side` controls overflow on the preferred placement axis (`top`/`bottom` or `left`/`right`): `'flip'`: keep the requested side when it fits; otherwise try the opposite side&#xA;(`top` and `bottom`, or `left` and `right`).`'shift'`: never change side; keep the requested side and move the popup within&#xA;the clipping boundary so it stays visible.`'none'`: do not correct side-axis overflow. `align` controls overflow on the alignment axis (`start`/`center`/`end`): `'flip'`: keep side, but swap `start` and `end` when the requested alignment overflows.`'shift'`: keep side and requested alignment, then nudge the popup along the&#xA;alignment axis to fit.`'none'`: do not correct alignment-axis overflow. `fallbackAxisSide` controls fallback behavior on the perpendicular axis when the&#xA;preferred axis cannot fit: `'start'`: allow perpendicular fallback and try the logical start side first&#xA;(`top` before `bottom`, or `left` before `right` in LTR).`'end'`: allow perpendicular fallback and try the logical end side first&#xA;(`bottom` before `top`, or `right` before `left` in LTR).`'none'`: do not fallback to the perpendicular axis. When `side` is `'shift'`, explicitly setting `align` only supports `'shift'` or `'none'`.&#xA;If `align` is omitted, it defaults to `'flip'`. |
| collisionBoundary     | `Boundary`                                                                                                           | `'clipping-ancestors'` | An element or a rectangle that delimits the area that the popup is confined to.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| collisionPadding      | `Padding`                                                                                                            | `5`                    | Additional space to maintain from the edge of the collision boundary.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| sticky                | `boolean`                                                                                                            | `false`                | Whether to maintain the popup in the viewport after&#xA;the anchor element was scrolled out of view.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| positionMethod        | `'absolute' \| 'fixed'`                                                                                              | `'absolute'`           | Determines which CSS `position` property to use.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| className             | `string \| ((state: Tooltip.Positioner.State) => string \| undefined)`                                               | -                      | CSS class applied to the element, or a function that&#xA;returns a class based on the component's state.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| style                 | `React.CSSProperties \| ((state: Tooltip.Positioner.State) => React.CSSProperties \| undefined)`                     | -                      | Style applied to the element, or a function that&#xA;returns a style object based on the component's state.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| render                | `ReactElement \| ((props: HTMLProps, state: Tooltip.Positioner.State) => ReactElement)`                              | -                      | Allows you to replace the component's HTML element&#xA;with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |

**`alignOffset` Prop Example:**

```jsx
<Positioner
  alignOffset={({ side, align, anchor, positioner }) => {
    return side === 'top' || side === 'bottom' ? anchor.width : anchor.height;
  }}
/>
```

**`sideOffset` Prop Example:**

```jsx
<Positioner
  sideOffset={({ side, align, anchor, positioner }) => {
    return side === 'top' || side === 'bottom' ? anchor.height : anchor.width;
  }}
/>
```

**`collisionAvoidance` Prop Example:**

```jsx
<Positioner
  collisionAvoidance={{
    side: 'shift',
    align: 'shift',
    fallbackAxisSide: 'none',
  }}
/>
```

**Positioner Data Attributes:**

| Attribute          | Type                                                                       | Description                                                           |
| :----------------- | :------------------------------------------------------------------------- | :-------------------------------------------------------------------- |
| data-open          | -                                                                          | Present when the tooltip is open.                                     |
| data-closed        | -                                                                          | Present when the tooltip is closed.                                   |
| data-anchor-hidden | -                                                                          | Present when the anchor is hidden.                                    |
| data-align         | `'start' \| 'center' \| 'end'`                                             | Indicates how the popup is aligned relative to specified side.        |
| data-side          | `'top' \| 'bottom' \| 'left' \| 'right' \| 'inline-end' \| 'inline-start'` | Indicates which side the popup is positioned relative to the trigger. |

**Positioner CSS Variables:**

| Variable              | Type     | Description                                                                                                                       |
| :-------------------- | :------- | :-------------------------------------------------------------------------------------------------------------------------------- |
| `--anchor-height`     | `number` | The anchor's height.                                                                                                              |
| `--anchor-width`      | `number` | The anchor's width.                                                                                                               |
| `--available-height`  | `number` | The available height between the trigger and the edge of the viewport.                                                            |
| `--available-width`   | `number` | The available width between the trigger and the edge of the viewport.                                                             |
| `--positioner-height` | `number` | The height of the tooltip's positioner.&#xA;It is important to set `height` to this value when using CSS to animate size changes. |
| `--positioner-width`  | `number` | The width of the tooltip's positioner.&#xA;It is important to set `width` to this value when using CSS to animate size changes.   |
| `--transform-origin`  | `string` | The coordinates that this element is anchored to. Used for animations and transitions.                                            |

### Positioner.Props [#positionerprops]

Re-export of [Positioner](#positioner) props.

### Positioner.State [#positionerstate]

```typescript
type TooltipPositionerState = {
  /** Whether the tooltip is currently open. */
  open: boolean;
  /** The side of the anchor the component is placed on. */
  side: Side;
  /** The alignment of the component relative to the anchor. */
  align: Align;
  /** Whether the anchor element is hidden. */
  anchorHidden: boolean;
  /** Whether CSS transitions should be disabled. */
  instant: string | undefined;
};
```

### Popup [#popup]

A container for the tooltip contents.
Renders a `<div>` element.

**Popup Props:**

| Prop      | Type                                                                                        | Default | Description                                                                                                                                                                                   |
| :-------- | :------------------------------------------------------------------------------------------ | :------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| className | `string \| ((state: Tooltip.Popup.State) => string \| undefined)`                           | -       | CSS class applied to the element, or a function that&#xA;returns a class based on the component's state.                                                                                      |
| style     | `React.CSSProperties \| ((state: Tooltip.Popup.State) => React.CSSProperties \| undefined)` | -       | Style applied to the element, or a function that&#xA;returns a style object based on the component's state.                                                                                   |
| render    | `ReactElement \| ((props: HTMLProps, state: Tooltip.Popup.State) => ReactElement)`          | -       | Allows you to replace the component's HTML element&#xA;with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |

**Popup Data Attributes:**

| Attribute           | Type                                                                       | Description                                                           |
| :------------------ | :------------------------------------------------------------------------- | :-------------------------------------------------------------------- |
| data-open           | -                                                                          | Present when the tooltip is open.                                     |
| data-closed         | -                                                                          | Present when the tooltip is closed.                                   |
| data-align          | `'start' \| 'center' \| 'end'`                                             | Indicates how the popup is aligned relative to specified side.        |
| data-instant        | `'delay' \| 'dismiss' \| 'focus'`                                          | Present if animations should be instant.                              |
| data-side           | `'top' \| 'bottom' \| 'left' \| 'right' \| 'inline-end' \| 'inline-start'` | Indicates which side the popup is positioned relative to the trigger. |
| data-starting-style | -                                                                          | Present when the tooltip begins animating in.                         |
| data-ending-style   | -                                                                          | Present when the tooltip is animating out.                            |

### Popup.Props [#popupprops]

Re-export of [Popup](#popup) props.

### Popup.State [#popupstate]

```typescript
type TooltipPopupState = {
  /** Whether the tooltip is currently open. */
  open: boolean;
  /** The side of the anchor the component is placed on. */
  side: Side;
  /** The alignment of the component relative to the anchor. */
  align: Align;
  /** Whether transitions should be skipped. */
  instant: 'delay' | 'focus' | 'dismiss' | undefined;
  /** The transition status of the component. */
  transitionStatus: TransitionStatus;
};
```

### Arrow [#arrow]

Displays an element positioned against the tooltip anchor.
Renders a `<div>` element.

**Arrow Props:**

| Prop      | Type                                                                                        | Default | Description                                                                                                                                                                                   |
| :-------- | :------------------------------------------------------------------------------------------ | :------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| className | `string \| ((state: Tooltip.Arrow.State) => string \| undefined)`                           | -       | CSS class applied to the element, or a function that&#xA;returns a class based on the component's state.                                                                                      |
| style     | `React.CSSProperties \| ((state: Tooltip.Arrow.State) => React.CSSProperties \| undefined)` | -       | Style applied to the element, or a function that&#xA;returns a style object based on the component's state.                                                                                   |
| render    | `ReactElement \| ((props: HTMLProps, state: Tooltip.Arrow.State) => ReactElement)`          | -       | Allows you to replace the component's HTML element&#xA;with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |

**Arrow Data Attributes:**

| Attribute       | Type                                                                       | Description                                                           |
| :-------------- | :------------------------------------------------------------------------- | :-------------------------------------------------------------------- |
| data-open       | -                                                                          | Present when the tooltip is open.                                     |
| data-closed     | -                                                                          | Present when the tooltip is closed.                                   |
| data-uncentered | -                                                                          | Present when the tooltip arrow is uncentered.                         |
| data-align      | `'start' \| 'center' \| 'end'`                                             | Indicates how the popup is aligned relative to specified side.        |
| data-instant    | `'delay' \| 'dismiss' \| 'focus'`                                          | Present if animations should be instant.                              |
| data-side       | `'top' \| 'bottom' \| 'left' \| 'right' \| 'inline-end' \| 'inline-start'` | Indicates which side the popup is positioned relative to the trigger. |

### Arrow\.Props [#arrowprops]

Re-export of [Arrow](#arrow) props.

### Arrow\.State [#arrowstate]

```typescript
type TooltipArrowState = {
  /** Whether the tooltip is currently open. */
  open: boolean;
  /** The side of the anchor the component is placed on. */
  side: Side;
  /** The alignment of the component relative to the anchor. */
  align: Align;
  /** Whether the arrow cannot be centered on the anchor. */
  uncentered: boolean;
  /** Whether transitions should be skipped. */
  instant: 'delay' | 'dismiss' | 'focus' | undefined;
};
```

### Viewport [#viewport]

A viewport for displaying content transitions.
This component is only required if one popup can be opened by multiple triggers, its content
changes based on the trigger, and switching between them is animated.
Renders a `<div>` element.

**Viewport Props:**

| Prop      | Type                                                                                           | Default | Description                                                                                                                                                                                   |
| :-------- | :--------------------------------------------------------------------------------------------- | :------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| children  | `React.ReactNode`                                                                              | -       | The content to render inside the transition container.                                                                                                                                        |
| className | `string \| ((state: Tooltip.Viewport.State) => string \| undefined)`                           | -       | CSS class applied to the element, or a function that&#xA;returns a class based on the component's state.                                                                                      |
| style     | `React.CSSProperties \| ((state: Tooltip.Viewport.State) => React.CSSProperties \| undefined)` | -       | Style applied to the element, or a function that&#xA;returns a style object based on the component's state.                                                                                   |
| render    | `ReactElement \| ((props: HTMLProps, state: Tooltip.Viewport.State) => ReactElement)`          | -       | Allows you to replace the component's HTML element&#xA;with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |

**Viewport Data Attributes:**

| Attribute                 | Type                                                       | Description                                                                                                                                                                                                                        |
| :------------------------ | :--------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| data-activation-direction | `` `${'left' \| 'right' \| ''} ${'down' \| 'up' \| ''}` `` | Indicates the direction from which the popup was activated.&#xA;This can be used to create directional animations based on how the popup was triggered.&#xA;Contains space-separated values for both horizontal and vertical axes. |
| data-current              | -                                                          | Applied to the direct child of the viewport when no transitions are present or the new content when it's entering.                                                                                                                 |
| data-instant              | `'delay' \| 'dismiss' \| 'focus'`                          | Present if animations should be instant.                                                                                                                                                                                           |
| data-previous             | -                                                          | Applied to the direct child of the viewport that contains the exiting content when transitions are present.                                                                                                                        |
| data-transitioning        | -                                                          | Indicates that the viewport is currently transitioning between old and new content.                                                                                                                                                |

**Viewport CSS Variables:**

| Variable         | Type | Description                                                                                                                                                                                                                                                           |
| :--------------- | :--- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--popup-height` | \`\` | The height of the parent popup.&#xA;This variable is placed on the 'previous' container and stores the height of the popup when the previous content was rendered.&#xA;It can be used to freeze the dimensions of the popup when animating between different content. |
| `--popup-width`  | \`\` | The width of the parent popup.&#xA;This variable is placed on the 'previous' container and stores the width of the popup when the previous content was rendered.&#xA;It can be used to freeze the dimensions of the popup when animating between different content.   |

### Viewport.Props [#viewportprops]

Re-export of [Viewport](#viewport) props.

### Viewport.State [#viewportstate]

```typescript
type TooltipViewportState = {
  /** The activation direction of the transitioned content. */
  activationDirection: string | undefined;
  /** Whether the viewport is currently transitioning between contents. */
  transitioning: boolean;
  /** Present if animations should be instant. */
  instant: 'delay' | 'dismiss' | 'focus' | undefined;
};
```

### createHandle [#createhandle]

Creates a new handle to connect a Tooltip.Root with detached Tooltip.Trigger components.

**Return Value:**

```tsx
type ReturnValue = Tooltip.Handle<Payload>;
```

### Handle [#handle]

Controls a Tooltip imperatively and associates detached `Tooltip.Trigger` components with a
`Tooltip.Root`. Create one with `Tooltip.createHandle()` and pass it to the `handle` prop of the
root and of any triggers rendered outside of it.

The imperative methods take effect only while a root using this handle is mounted; calls made
before a root attaches (or after it unmounts) are ignored.

**Properties:**

| Property | Type      | Modifiers | Description                                                                                     |
| :------- | :-------- | :-------- | :---------------------------------------------------------------------------------------------- |
| isOpen   | `boolean` | readonly  | Whether the tooltip is currently open. Returns `false` while no root is attached to the handle. |

**Methods:**

```typescript
function open(triggerId: string): void;
```

Opens the tooltip and associates it with the trigger with the given id.

This method should only be called in an event handler or an effect (not during rendering).

```typescript
function close(): void;
```

Closes the tooltip.

This method should only be called in an event handler or an effect (not during rendering).

## External Types [#external-types]

### PayloadChildRenderFunction [#payloadchildrenderfunction]

```typescript
type PayloadChildRenderFunction = (arg: { payload: unknown | undefined }) => ReactNode;
```

### preventUnmountOnClose [#preventunmountonclose]

```typescript
type preventUnmountOnClose = () => void;
```

### Side [#side]

```typescript
type Side = 'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start';
```

### Align [#align]

```typescript
type Align = 'start' | 'center' | 'end';
```

### OffsetFunction [#offsetfunction]

```typescript
type OffsetFunction = (data: {
  side: 'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start';
  align: 'start' | 'center' | 'end';
  anchor: { width: number; height: number };
  positioner: { width: number; height: number };
}) => number;
```

## Export Groups [#export-groups]

* `Tooltip.Root`: `Tooltip.Root`, `Tooltip.Root.State`, `Tooltip.Root.Props`, `Tooltip.Root.Actions`, `Tooltip.Root.ChangeEventReason`, `Tooltip.Root.ChangeEventDetails`
* `Tooltip.Trigger`: `Tooltip.Trigger`, `Tooltip.Trigger.State`, `Tooltip.Trigger.Props`
* `Tooltip.Portal`: `Tooltip.Portal`, `Tooltip.Portal.State`, `Tooltip.Portal.Props`
* `Tooltip.Positioner`: `Tooltip.Positioner`, `Tooltip.Positioner.State`, `Tooltip.Positioner.Props`
* `Tooltip.Popup`: `Tooltip.Popup`, `Tooltip.Popup.State`, `Tooltip.Popup.Props`
* `Tooltip.Arrow`: `Tooltip.Arrow`, `Tooltip.Arrow.State`, `Tooltip.Arrow.Props`
* `Tooltip.Provider`: `Tooltip.Provider`, `Tooltip.Provider.State`, `Tooltip.Provider.Props`
* `Tooltip.Viewport`: `Tooltip.Viewport`, `Tooltip.Viewport.Props`, `Tooltip.Viewport.State`
* `Tooltip.createHandle`
* `Tooltip.Handle`
* `Default`: `TooltipProviderState`, `TooltipProviderProps`, `TooltipRootState`, `TooltipRootProps`, `TooltipRootActions`, `TooltipRootChangeEventReason`, `TooltipRootChangeEventDetails`, `TooltipTriggerState`, `TooltipTriggerProps`, `TooltipPortalState`, `TooltipPortalProps`, `TooltipPositionerState`, `TooltipPositionerProps`, `TooltipPopupState`, `TooltipPopupProps`, `TooltipViewportState`, `TooltipViewportProps`, `TooltipArrowState`, `TooltipArrowProps`

## Canonical Types [#canonical-types]

Maps `Canonical`: `Alias` — Use Canonical when its namespace is already imported; otherwise use Alias.

* `Tooltip.Root.State`: `TooltipRootState`
* `Tooltip.Root.Props`: `TooltipRootProps`
* `Tooltip.Root.Actions`: `TooltipRootActions`
* `Tooltip.Root.ChangeEventReason`: `TooltipRootChangeEventReason`
* `Tooltip.Root.ChangeEventDetails`: `TooltipRootChangeEventDetails`
* `Tooltip.Trigger.State`: `TooltipTriggerState`
* `Tooltip.Trigger.Props`: `TooltipTriggerProps`
* `Tooltip.Portal.State`: `TooltipPortalState`
* `Tooltip.Portal.Props`: `TooltipPortalProps`
* `Tooltip.Positioner.State`: `TooltipPositionerState`
* `Tooltip.Positioner.Props`: `TooltipPositionerProps`
* `Tooltip.Popup.State`: `TooltipPopupState`
* `Tooltip.Popup.Props`: `TooltipPopupProps`
* `Tooltip.Arrow.State`: `TooltipArrowState`
* `Tooltip.Arrow.Props`: `TooltipArrowProps`
* `Tooltip.Provider.State`: `TooltipProviderState`
* `Tooltip.Provider.Props`: `TooltipProviderProps`
* `Tooltip.Viewport.Props`: `TooltipViewportProps`
* `Tooltip.Viewport.State`: `TooltipViewportState`
