usePopover API
Related
Explore these related pages for additional context and usage patterns.
| Page | Category |
|---|---|
| usePopover | System |
| Popover | Disclosure |
| useClickOutside | System |
| useEventListener | System |
Functions
createPopoverFallback
() => PopoverPluginContextSynthesized fallback used when usePopover() is called without
app.use(createPopoverPlugin()). Returns { adapter: undefined } so
resolution falls through to V0PopoverAdapter.
usePopover
(options?: PopoverOptions) => PopoverReturntoPlacement
typeof toPlacementcreatePopoverContext
<_E>(_options?: PopoverPluginOptions | undefined) => ContextTrinity<_E>createPopoverPlugin
(_options?: PopoverPluginOptions | undefined) => PluginOptions
positionTry
MaybeRefOrGetter<string | undefined>CSS position-try-fallbacks value
Default: 'most-width bottom'
isOpen
Ref<boolean, boolean> | undefinedExternal ref for bidirectional open state (e.g., from defineModel)
adapter
PopoverAdapter | undefinedPositioning engine. Resolution: per-instance adapter, then the
createPopoverPlugin adapter, then new V0PopoverAdapter() (CSS
anchor positioning, zero runtime dependency).
Properties
anchorStyles
Readonly<Ref<Record<string, string>, Record<string, string>>>Styles to spread on the activator element (anchor-name)
contentAttrs
Readonly<Ref<{ id: string; popover: ""; }, { id: string; popover: ""; }>>Attrs to spread on the content element (id, popover)
contentStyles
Readonly<Ref<Record<string, string>, Record<string, string>>>Styles to spread on the content element. Owned by the active adapter —
CSS anchor declarations from V0PopoverAdapter, or whatever a custom
engine (e.g. Floating UI) returns. Not inherently CSS-anchor styles.
Methods
attach
(el: MaybeRefOrGetter<HTMLElement | null | undefined>) => voidAttach to a content element — wires show/hide watch + toggle event sync
attachAnchor
(el: MaybeRefOrGetter<Element | null | undefined>) => voidRegister the activator/reference element with the positioning adapter