# Popover (/cloud/headless/popover)



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

## In Nyte [#in-nyte]

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

`@nyte-ai/ui/popover` 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/conversation/composer-suggestions.tsx`

The rest of this page is Base UI's documentation for `@base-ui/react/popover`, 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.

## Anatomy [#anatomy]

Import the component and assemble its parts:

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

<Popover.Root>
  <Popover.Trigger />
  <Popover.Portal>
    <Popover.Backdrop />
    <Popover.Positioner>
      <Popover.Popup>
        <Popover.Arrow />
        <Popover.Viewport>
          <Popover.Title />
          <Popover.Description />
          <Popover.Close />
        </Popover.Viewport>
      </Popover.Popup>
    </Popover.Positioner>
  </Popover.Portal>
</Popover.Root>;
```

## Examples [#examples]

### Opening on hover [#opening-on-hover]

This example shows how you can configure the popover to open on hover using the `openOnHover` prop.

You can use the `delay` prop to specify how long to wait (in milliseconds) before the popover opens on hover.

### Detached triggers [#detached-triggers]

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

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

The imperative methods on the handle, such as `open()` and `close()`, require a `<Popover.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 demoPopover = Popover.createHandle();

// @highlight
// @highlight-text "handle={demoPopover}"
<Popover.Trigger handle={demoPopover}>
  Trigger
</Popover.Trigger>

// @highlight
// @highlight-text "handle={demoPopover}"
<Popover.Root handle={demoPopover}>
  ...
</Popover.Root>
```

### Multiple triggers [#multiple-triggers]

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

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

```jsx title="Multiple detached triggers"
const demoPopover = Popover.createHandle();

<Popover.Trigger handle={demoPopover}>
  Trigger 1
</Popover.Trigger>

<Popover.Trigger handle={demoPopover}>
  Trigger 2
</Popover.Trigger>

<Popover.Root handle={demoPopover}>
  ...
</Popover.Root>
```

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

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

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

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

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

<Popover.Root handle={demoPopover}>
  {({ payload }) => ( // @highlight-text "payload"
    <Popover.Portal>
      <Popover.Positioner sideOffset={8}>
        <Popover.Popup className={styles.Popup}>
          <Popover.Arrow className={styles.Arrow}>
            <ArrowSvg />
          </Popover.Arrow>
          <Popover.Title className={styles.Title}>Popover</Popover.Title>
          {payload !== undefined && ( // @highlight-text "payload"
            <Popover.Description className={styles.Description}>
              This has been opened by {payload.text} {/* @highlight-text "payload" */}
            </Popover.Description>
          )}
        </Popover.Popup>
      </Popover.Positioner>
    </Popover.Portal>
  )}
</Popover.Root>
```

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

You can control the popover's open state externally using the `open` and `onOpenChange` props on `<Popover.Root>`.
This allows you to manage the popover'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 `<Popover.Root>` and the `id` prop on each `<Popover.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 Popover [#animating-the-popover]

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

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

To animate the popover'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 popover also supports content transitions.
This is useful when different triggers display different content within the same popover.

To enable content animations, wrap the content in the `<Popover.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 `<Popover.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 popover.
Doesn't render its own HTML element.

**Root Props:**

| Prop                 | Type                                                                       | Default | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| :------------------- | :------------------------------------------------------------------------- | :------ | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| defaultOpen          | `boolean`                                                                  | `false` | Whether the popover is initially open. To render a controlled popover, use the `open` prop instead.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| open                 | `boolean`                                                                  | -       | Whether the popover is currently open.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| onOpenChange         | `((open: boolean, eventDetails: Popover.Root.ChangeEventDetails) => void)` | -       | Event handler called when the popover is opened or closed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| actionsRef           | `React.RefObject<Popover.Root.Actions \| null>`                            | -       | A ref to imperative actions. `unmount`: Manually unmounts the popover.&#xA;Call this after any externally controlled closing animation finishes.`close`: Closes the popover imperatively when called.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| defaultTriggerId     | `string \| null`                                                           | -       | ID of the trigger that the popover is associated with.&#xA;This is useful in conjunction with the `defaultOpen` prop to create an initially open popover.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| handle               | `Popover.Handle<Payload>`                                                  | -       | A handle to associate the popover with a trigger.&#xA;If specified, allows external triggers to control the popover's open state.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| modal                | `boolean \| 'trap-focus'`                                                  | `false` | Determines if the popover enters a modal state when open. `true`: user interaction is limited to the popover: document page scroll is locked, and pointer interactions on outside elements are disabled.`false`: user interaction with the rest of the document is allowed.`'trap-focus'`: focus is trapped inside the popover, but document page scroll is not locked and pointer interactions outside of it remain enabled. On touch devices, a `true` modal blocks outside taps but leaves the page scrollable unless the popup spans nearly the full viewport width, matching native iOS behavior. When `modal` is `true`, focus trapping is enabled only if `<Popover.Close>` is rendered&#xA;inside `<Popover.Popup>`. It can be visually hidden with your own CSS if needed, such as&#xA;Tailwind's `sr-only` utility. When `modal` is `'trap-focus'`, render `<Popover.Close>` inside `<Popover.Popup>` so touch&#xA;screen readers can escape the popup. |
| onOpenChangeComplete | `((open: boolean) => void)`                                                | -       | Event handler called after any animations complete when the popover is opened or closed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| triggerId            | `string \| null`                                                           | -       | ID of the trigger that the popover is associated with.&#xA;This is useful in conjunction with the `open` prop to create a controlled popover.&#xA;There's no need to specify this prop when the popover is uncontrolled (that is, when the `open` prop is not set).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| children             | `React.ReactNode \| PayloadChildRenderFunction<Payload>`                   | -       | The content of the popover.&#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 PopoverRootState = {};
```

### Root.Actions [#rootactions]

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

### Root.ChangeEventReason [#rootchangeeventreason]

```typescript
type PopoverRootChangeEventReason =
  | 'trigger-hover'
  | 'trigger-focus'
  | 'trigger-press'
  | 'outside-press'
  | 'escape-key'
  | 'close-press'
  | 'focus-out'
  | 'imperative-action'
  | 'none';
```

### Root.ChangeEventDetails [#rootchangeeventdetails]

```typescript
type PopoverRootChangeEventDetails = (
  | { 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: 'close-press'; event: MouseEvent | PointerEvent | KeyboardEvent }
  | { reason: 'focus-out'; event: FocusEvent | KeyboardEvent }
  | { 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;
};
```

### Trigger [#trigger]

A button that opens the popover.
Renders a `<button>` element.

**Trigger Props:**

| Prop         | Type                                                                                          | Default | Description                                                                                                                                                                                               |
| :----------- | :-------------------------------------------------------------------------------------------- | :------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| handle       | `Popover.Handle<Payload>`                                                                     | -       | A handle to associate the trigger with a popover.                                                                                                                                                         |
| nativeButton | `boolean`                                                                                     | `true`  | Whether the component renders a native `<button>` element when replacing it&#xA;via the `render` prop.&#xA;Set to `false` if the rendered element is not a button (for example, `<div>`).                 |
| payload      | `Payload`                                                                                     | -       | A payload to pass to the popover when it is opened.                                                                                                                                                       |
| openOnHover  | `boolean`                                                                                     | `false` | Whether the popover should also open when the trigger is hovered.                                                                                                                                         |
| delay        | `number`                                                                                      | `300`   | How long to wait before the popover may be opened on hover. Specified in milliseconds. Requires the `openOnHover` prop.                                                                                   |
| closeDelay   | `number`                                                                                      | `0`     | How long to wait before closing the popover that was opened on hover.&#xA;Specified in milliseconds. Requires the `openOnHover` prop.                                                                     |
| id           | `string`                                                                                      | -       | ID of the trigger. In addition to being forwarded to the rendered element,&#xA;it is also used to specify the active trigger for the popover in controlled mode (with the Popover.Root `triggerId` prop). |
| className    | `string \| ((state: Popover.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: Popover.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: Popover.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 popover is open. |
| data-pressed    | -    | Present when the trigger is pressed.            |
| data-disabled   | -    | Present when the trigger is disabled.           |

### Trigger.Props [#triggerprops]

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

### Trigger.State [#triggerstate]

```typescript
type PopoverTriggerState = {
  /** Whether the trigger is currently disabled. */
  disabled: boolean;
  /** Whether the popover 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: Popover.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: Popover.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: Popover.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 PopoverPortalState = {};
```

### Backdrop [#backdrop]

An overlay displayed beneath the popover.
Renders a `<div>` element.

**Backdrop Props:**

| Prop      | Type                                                                                           | Default | Description                                                                                                                                                                                   |
| :-------- | :--------------------------------------------------------------------------------------------- | :------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| className | `string \| ((state: Popover.Backdrop.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: Popover.Backdrop.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: Popover.Backdrop.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. |

**Backdrop Data Attributes:**

| Attribute           | Type | Description                                 |
| :------------------ | :--- | :------------------------------------------ |
| data-open           | -    | Present when the popup is open.             |
| data-closed         | -    | Present when the popup is closed.           |
| data-starting-style | -    | Present when the popup begins animating in. |
| data-ending-style   | -    | Present when the popup is animating out.    |

### Backdrop.Props [#backdropprops]

Re-export of [Backdrop](#backdrop) props.

### Backdrop.State [#backdropstate]

```typescript
type PopoverBackdropState = {
  /** Whether the popover is currently open. */
  open: boolean;
  /** The transition status of the component. */
  transitionStatus: TransitionStatus;
};
```

### Positioner [#positioner]

Positions the popover 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`                                                                                                               | `'bottom'`             | 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: Popover.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: Popover.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: Popover.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 popup is open.                                       |
| data-closed        | -                                                                          | Present when the popup 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 popover'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 popover'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 PopoverPositionerState = {
  /** Whether the popover 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 popover contents.
Renders a `<div>` element.

**Popup Props:**

| Prop         | Type                                                                                                                          | Default | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| :----------- | :---------------------------------------------------------------------------------------------------------------------------- | :------ | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| initialFocus | `boolean \| React.RefObject<HTMLElement \| null> \| ((openType: InteractionType) => boolean \| void \| HTMLElement \| null)`  | -       | Determines the element to focus when the popover is opened.&#xA;By default, focus moves to the first tabbable element inside the popup, except when the popover&#xA;is opened by touch — then the popup itself is focused to avoid opening the virtual keyboard. `false`: Do not move focus.`true`: Move focus based on the default behavior (first tabbable element or popup).`RefObject`: Move focus to the ref element.`function`: Called with the interaction type (`mouse`, `touch`, `pen`, or `keyboard`).&#xA;Return an element to focus, `true` to use the default behavior, `null` to fall back to the default behavior, or `false`/`undefined` to do nothing. |
| finalFocus   | `boolean \| React.RefObject<HTMLElement \| null> \| ((closeType: InteractionType) => boolean \| void \| HTMLElement \| null)` | -       | Determines the element to focus when the popover is closed. `false`: Do not move focus.`true`: Move focus based on the default behavior (trigger or previously focused element).`RefObject`: Move focus to the ref element.`function`: Called with the interaction type (`mouse`, `touch`, `pen`, or `keyboard`).&#xA;Return an element to focus, `true` to use the default behavior, `null` to fall back to the default behavior, or `false`/`undefined` to do nothing.                                                                                                                                                                                                |
| className    | `string \| ((state: Popover.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: Popover.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: Popover.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 popup is open.                                       |
| data-closed         | -                                                                          | Present when the popup is closed.                                     |
| data-align          | `'start' \| 'center' \| 'end'`                                             | Indicates how the popup is aligned relative to specified side.        |
| data-instant        | `'click' \| 'dismiss' \| 'focus' \| 'trigger-change'`                      | 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 popup begins animating in.                           |
| data-ending-style   | -                                                                          | Present when the popup is animating out.                              |

**Popup CSS Variables:**

| Variable         | Type | Description              |
| :--------------- | :--- | :----------------------- |
| `--popup-height` | \`\` | The height of the popup. |
| `--popup-width`  | \`\` | The width of the popup.  |

### Popup.Props [#popupprops]

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

### Popup.State [#popupstate]

```typescript
type PopoverPopupState = {
  /** Whether the popover 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;
  /** The transition status of the component. */
  transitionStatus: TransitionStatus;
  /** Whether transitions should be skipped. */
  instant: 'dismiss' | 'click' | 'focus' | 'trigger-change' | undefined;
};
```

### Arrow [#arrow]

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

**Arrow Props:**

| Prop      | Type                                                                                        | Default | Description                                                                                                                                                                                   |
| :-------- | :------------------------------------------------------------------------------------------ | :------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| className | `string \| ((state: Popover.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: Popover.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: Popover.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 popup is open.                                       |
| data-closed     | -                                                                          | Present when the popup is closed.                                     |
| data-uncentered | -                                                                          | Present when the popover arrow is uncentered.                         |
| 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. |

### Arrow\.Props [#arrowprops]

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

### Arrow\.State [#arrowstate]

```typescript
type PopoverArrowState = {
  /** Whether the popover 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;
};
```

### Title [#title]

A heading that labels the popover.
Renders an `<h2>` element.

**Title Props:**

| Prop      | Type                                                                                        | Default | Description                                                                                                                                                                                   |
| :-------- | :------------------------------------------------------------------------------------------ | :------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| className | `string \| ((state: Popover.Title.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: Popover.Title.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: Popover.Title.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. |

### Title.Props [#titleprops]

Re-export of [Title](#title) props.

### Title.State [#titlestate]

```typescript
type PopoverTitleState = {};
```

### Description [#description]

A paragraph with additional information about the popover.
Renders a `<p>` element.

**Description Props:**

| Prop      | Type                                                                                              | Default | Description                                                                                                                                                                                   |
| :-------- | :------------------------------------------------------------------------------------------------ | :------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| className | `string \| ((state: Popover.Description.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: Popover.Description.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: Popover.Description.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. |

### Description.Props [#descriptionprops]

Re-export of [Description](#description) props.

### Description.State [#descriptionstate]

```typescript
type PopoverDescriptionState = {};
```

### Close [#close]

A button that closes the popover.
Renders a `<button>` element.

**Close Props:**

| Prop         | Type                                                                                        | Default | Description                                                                                                                                                                                   |
| :----------- | :------------------------------------------------------------------------------------------ | :------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| nativeButton | `boolean`                                                                                   | `true`  | Whether the component renders a native `<button>` element when replacing it&#xA;via the `render` prop.&#xA;Set to `false` if the rendered element is not a button (for example, `<div>`).     |
| className    | `string \| ((state: Popover.Close.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: Popover.Close.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: Popover.Close.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. |

### Close.Props [#closeprops]

Re-export of [Close](#close) props.

### Close.State [#closestate]

```typescript
type PopoverCloseState = {};
```

### 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: Popover.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: Popover.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: Popover.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              | `'click' \| 'dismiss' \| 'focus' \| 'trigger-change'`      | 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 PopoverViewportState = {
  /** 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: 'dismiss' | 'click' | 'focus' | 'trigger-change' | undefined;
};
```

### createHandle [#createhandle]

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

**Return Value:**

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

### Handle [#handle]

Controls a Popover imperatively and associates detached `Popover.Trigger` components with a
`Popover.Root`. Create one with `Popover.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 popover is currently open. Returns `false` while no root is attached to the handle. |

**Methods:**

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

Opens the popover 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 popover.

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;
```

### InteractionType [#interactiontype]

```typescript
type InteractionType = 'mouse' | 'touch' | 'pen' | 'keyboard' | '';
```

## Export Groups [#export-groups]

* `Popover.Root`: `Popover.Root`, `Popover.Root.State`, `Popover.Root.Props`, `Popover.Root.Actions`, `Popover.Root.ChangeEventReason`, `Popover.Root.ChangeEventDetails`
* `Popover.Trigger`: `Popover.Trigger`, `Popover.Trigger.State`, `Popover.Trigger.Props`
* `Popover.Portal`: `Popover.Portal`, `Popover.Portal.State`, `Popover.Portal.Props`
* `Popover.Positioner`: `Popover.Positioner`, `Popover.Positioner.State`, `Popover.Positioner.Props`
* `Popover.Popup`: `Popover.Popup`, `Popover.Popup.State`, `Popover.Popup.Props`
* `Popover.Arrow`: `Popover.Arrow`, `Popover.Arrow.State`, `Popover.Arrow.Props`
* `Popover.Backdrop`: `Popover.Backdrop`, `Popover.Backdrop.State`, `Popover.Backdrop.Props`
* `Popover.Title`: `Popover.Title`, `Popover.Title.State`, `Popover.Title.Props`
* `Popover.Description`: `Popover.Description`, `Popover.Description.State`, `Popover.Description.Props`
* `Popover.Close`: `Popover.Close`, `Popover.Close.State`, `Popover.Close.Props`
* `Popover.Viewport`: `Popover.Viewport`, `Popover.Viewport.Props`, `Popover.Viewport.State`
* `Popover.createHandle`
* `Popover.Handle`
* `Default`: `PopoverRootState`, `PopoverRootProps`, `PopoverRootActions`, `PopoverRootChangeEventReason`, `PopoverRootChangeEventDetails`, `PopoverTriggerState`, `PopoverTriggerProps`, `PopoverPortalState`, `PopoverPortalProps`, `PopoverPositionerState`, `PopoverPositionerProps`, `PopoverPopupState`, `PopoverPopupProps`, `PopoverArrowState`, `PopoverArrowProps`, `PopoverBackdropState`, `PopoverBackdropProps`, `PopoverTitleState`, `PopoverTitleProps`, `PopoverDescriptionState`, `PopoverDescriptionProps`, `PopoverCloseState`, `PopoverCloseProps`, `PopoverViewportState`, `PopoverViewportProps`

## Canonical Types [#canonical-types]

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

* `Popover.Root.State`: `PopoverRootState`
* `Popover.Root.Props`: `PopoverRootProps`
* `Popover.Root.Actions`: `PopoverRootActions`
* `Popover.Root.ChangeEventReason`: `PopoverRootChangeEventReason`
* `Popover.Root.ChangeEventDetails`: `PopoverRootChangeEventDetails`
* `Popover.Trigger.State`: `PopoverTriggerState`
* `Popover.Trigger.Props`: `PopoverTriggerProps`
* `Popover.Portal.State`: `PopoverPortalState`
* `Popover.Portal.Props`: `PopoverPortalProps`
* `Popover.Positioner.State`: `PopoverPositionerState`
* `Popover.Positioner.Props`: `PopoverPositionerProps`
* `Popover.Popup.State`: `PopoverPopupState`
* `Popover.Popup.Props`: `PopoverPopupProps`
* `Popover.Arrow.State`: `PopoverArrowState`
* `Popover.Arrow.Props`: `PopoverArrowProps`
* `Popover.Backdrop.State`: `PopoverBackdropState`
* `Popover.Backdrop.Props`: `PopoverBackdropProps`
* `Popover.Title.State`: `PopoverTitleState`
* `Popover.Title.Props`: `PopoverTitleProps`
* `Popover.Description.State`: `PopoverDescriptionState`
* `Popover.Description.Props`: `PopoverDescriptionProps`
* `Popover.Close.State`: `PopoverCloseState`
* `Popover.Close.Props`: `PopoverCloseProps`
* `Popover.Viewport.Props`: `PopoverViewportProps`
* `Popover.Viewport.State`: `PopoverViewportState`
