Loading...
Installation
Install the following dependencies:
Copy and paste the following code into your project.
Loading...
Update the import paths to match your project setup.
Composition
Popover ├── PopoverAnchor | PopoverTrigger └── PopoverPositioner └── PopoverContent ├── PopoverHeader (optional) │ ├── PopoverTitle │ └── PopoverDescription ├── content ├── PopoverCloseTrigger (optional) └── PopoverArrow (optional)
Examples
Default
Loading...
Filters
Loading...
Notifications
Loading...
Placement
Loading...
With Form
Loading...
API Reference
Popover
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | undefined | — | Unique identifier used to connect the component parts. |
translations | IntlTranslations | undefined | — | Configures translations. |
ids | ElementIds | undefined | — | Overrides generated identifiers for individual parts. |
modal | boolean | undefined | — | Configures modal. |
portalled | boolean | undefined | — | Configures portalled. |
autoFocus | boolean | undefined | — | Configures auto focus. |
initialFocusEl | (() => HTMLElement | null) | undefined | — | Configures initial focus el. |
finalFocusEl | (() => MaybeElement) | undefined | — | Configures final focus el. |
restoreFocus | boolean | undefined | — | Configures restore focus. |
closeOnInteractOutside | boolean | undefined | true | Configures close on interact outside. |
closeOnEscape | boolean | undefined | true | Configures close on escape. |
onOpenChange | ((details: OpenChangeDetails) => void) | undefined | — | Runs when open changes. |
positioning | PositioningOptions | undefined | — | Configures floating-element placement and collision handling. |
open | boolean | undefined | — | Whether the component is open when controlled. |
defaultOpen | boolean | undefined | — | Initial open state when uncontrolled. |
triggerValue | string | null | undefined | — | Configures trigger value. |
defaultTriggerValue | string | null | undefined | — | Configures default trigger value. |
onTriggerValueChange | ((details: TriggerValueChangeDetails) => void) | undefined | — | Runs when trigger value changes. |
Context, Hooks, and Types
| Export | API |
|---|---|
PopoverContext | Render-prop component that exposes component state and actions. |
PopoverRootProvider | Provides an externally created API to the component tree. |
usePopover | Creates or accesses the component API. |
usePopoverContext | Returns the nearest component API. |
PopoverOpenChangeDetails | Type for the details object passed to the matching change callback. |
Angular
React
Solid
Svelte
Vue