Skip to content

Popover

Attach interactive supporting content to a trigger without blocking the page.

Usage

Anchored

Keep the popup attached to its trigger while the surrounding layout changes.

Keep the popup attached to its trigger while the surrounding layout changes.

Controlled

Let the parent own the current value and apply accepted changes back to the component.

Let the parent own the current value and apply accepted changes back to the component.

Examples

Collision

Flip or shift the popup when its preferred side would leave the viewport.

Flip or shift the popup when its preferred side would leave the viewport.

Outside interaction

closeOnInteractOutside controls whether a pointer interaction outside the content closes it. Elements in interactOutsideExclusions stay interactive in a modal and do not count as outside. For conditional decisions, call preventDefault() from the interact-outside event.

template
<PopoverRoot
  :interact-outside-exclusions="[ignoredElement]"
  @interact-outside="(event) => {
    if (event.isInside(temporarilyIgnoredElement)) event.preventDefault()
  }"
/>

Floating positioning

This component uses the shared positioning engine. Use the live positioning example to change side, align, offsets, collision boundaries, strategy, and tracking while inspecting the resolved placement.

API

Vue package: @sectile/vue/popover

Components
  • PopoverRoot
  • PopoverTrigger
  • PopoverAnchor
  • PopoverPortal
  • PopoverContent
  • PopoverTitle
  • PopoverDescription
  • PopoverClose
  • PopoverArrow

Props

PopoverRootProps

align

Alignment of positioned content relative to its anchor.

arrowPadding

Minimum space kept between an arrow and the edge of positioned content.

autoFocus

Whether focus moves into the component when it opens.

avoidCollisions

Whether positioned content may flip or shift to remain visible.

closeOnInteractOutside

Whether interaction outside the content closes it.

collisionBoundary

Boundary used to keep positioned content visible.

collisionPadding

Space kept between positioned content and its collision boundary.

defaultOpen

Initial uncontrolled open state.

disabled

Whether interaction is unavailable.

hideWhenDetached

Whether positioned content hides when its anchor leaves the layout.

initialFocus

Element or resolver that receives focus when the component opens.

interactOutsideExclusions

Elements that stay interactive and do not count as outside interaction.

label

Accessible name announced for the control.

modal

Whether open content blocks interaction with the surrounding page.

open

Whether the associated popup or disclosure is open.

position

Whether the popup is positioned relative to its trigger.

restoreFocus

Whether focus returns to the trigger when open content closes.

side

Preferred side of the anchor for positioned content.

sideOffset

Distance between positioned content and its anchor.

strategy

CSS positioning strategy used for anchored content.

tracking

Update strategy used while anchored content is open.

trapFocus

Whether keyboard focus stays inside open content.

unmountOnExit

Whether presence-managed content is removed from the DOM after its exit motion completes.

PopoverPartProps

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

PopoverPortalProps

defer

Whether Teleport target resolution waits until the end of the current mount or update tick.

disabled

Whether interaction is unavailable.

to

Teleport target for portalled content.

Slots

PopoverRootSlotProps

disabled

Whether interaction is unavailable.

open

Whether the associated popup or disclosure is open.

Other types

PopoverOpenChangeHandler

ts
type PopoverOpenChangeHandler = PopupFactoryOptions['onOpenChange']

PopoverInteractOutsideHandler

ts
type PopoverInteractOutsideHandler = NonNullable<PopupFactoryOptions['onInteractOutside']>

Parts

Shared scope: [data-scope="popover"]. Combine it with a part selector to keep styles local to this component.

PartSelectorRoleExtra attributes
trigger[data-part="trigger"]Opens, closes, or activates the associated content.
anchor[data-part="anchor"]Provides the positioning reference for floating content.
content[data-part="content"]Contains the component content shown for the active state.
title[data-part="title"]Labels the associated content.
description[data-part="description"]Describes the associated content or decision.
close[data-part="close"]Closes or dismisses the current surface.
arrow[data-part="arrow"]Visually connects floating content to its anchor.

Keyboard interaction

KeyBehavior
Enter / SpaceActivate the trigger or focused action.
Tab / Shift+TabMove through available controls; modal content keeps focus inside.
EscapeClose the popup and restore focus when configured.

Accessibility

The trigger exposes expanded state and popup ownership; optional title and description label the floating content.

See the corresponding WAI-ARIA pattern for the host accessibility contract.

Released under the MIT License.