"use client";
import { Popover } from "@pixxl-tools/components";| Prop | Type | Default | Description |
|---|---|---|---|
title | ReactNode | — | Accessible heading rendered at the top and wired to aria-labelledby. |
trigger | ReactElement | — | Element that toggles the popover (gets aria-expanded/aria-controls). |
anchorRef | RefObject<Element | null> | — | External anchor (instead of trigger). |
autoFocus | boolean | true | Move focus into the popover on open (default true when anchored). |
container | Element | DocumentFragment | null | document.body | Portal container (default document.body). |
defaultOpen | boolean | — | Initial open state when uncontrolled. |
finalFocus | RefObject<HTMLElement | null> | the trigger, or the previously focused element | Element focused when the overlay closes (default: the trigger, or the previously focused element). |
initialFocus | RefObject<HTMLElement | null> | first tabbable content | Element focused when the overlay opens (default: first tabbable content). |
modal | boolean | false | Trap focus, make the page inert and lock scroll (default false). |
offset | number | 8 | Gap to the anchor in px (default 8). |
titleReactNode
Accessible heading rendered at the top and wired to aria-labelledby.
triggerReactElement
Element that toggles the popover (gets aria-expanded/aria-controls).
anchorRefRefObject<Element | null>
External anchor (instead of trigger).
autoFocusdefault trueboolean
Move focus into the popover on open (default true when anchored).
containerdefault document.bodyElement | DocumentFragment | null
Portal container (default document.body).
defaultOpenboolean
Initial open state when uncontrolled.
finalFocusdefault the trigger, or the previously focused elementRefObject<HTMLElement | null>
Element focused when the overlay closes (default: the trigger, or the previously focused element).
initialFocusdefault first tabbable contentRefObject<HTMLElement | null>
Element focused when the overlay opens (default: first tabbable content).
modaldefault falseboolean
Trap focus, make the page inert and lock scroll (default false).
offsetdefault 8number
Gap to the anchor in px (default 8).
Other props are passed to the root element (HTMLAttributes<HTMLDivElement>), including className, style, id and aria-* attributes.
<Popover title="Details" trigger={<Button>Show details</Button>}>…</Popover>