Overlays

Popover

A non-modal surface anchored to a trigger, for a small amount of content or a short form. Focus moves in, but nothing traps it — Tab can leave, and doing so closes it.

Installation #

With the Nuxt module, every component is auto-imported — there is nothing to add. In a plain Vue project, import what you use:

Copy
import { JPopover } from '@juxtui/ui'

Usage #

Copy
<JPopover v-model:open="open">
  <template #trigger>
    <JButton variant="outline">Notifications</JButton>
  </template>
  <p class="text-sm text-fg-secondary">You’re all caught up.</p>
</JPopover>

Unlike JDialog, the popover is not modal: the rest of the page stays interactive, and there is no focus trap or scroll lock. Reach for JDialog or JSheet when the content needs the user’s full attention.

The trigger slot takes your own element — attributes and listeners are merged onto it, no wrapper element is added.

Variants & examples #

Placement#

placement sets the preferred side and alignment, flipping automatically when there isn’t room.

Filter form#

The default slot exposes close, so a form can dismiss itself on submit.

API #

Props

PropTypeDefault Description
openbooleanfalseBound with v-model:open.
placementPlacement'bottom'Preferred side and alignment. Flips when there isn’t room.
offsetnumber8Distance from the trigger in px.
ariaLabelstring—Accessible name of the popover content.
closeOnOutsidebooleantrueClose when focus or a click leaves the popover.
disabledbooleanfalsePrevent opening.

Events

EventPayload Description
update:openbooleanEmitted when the popover opens or closes.

Slots

SlotProps Description
trigger{ open }The element that opens the popover.
default{ close }Popover content.

Methods

MethodSignature Description
close()() => voidClose the popover and return focus to the trigger.

Accessibility #

  • role="dialog" without aria-modal; the trigger gets aria-haspopup="dialog", aria-expanded and aria-controls.
  • On open, focus moves to an element marked autofocus, else the first focusable element, else the popover itself.
  • A pointer press outside both the trigger and the popover closes it — without returning focus — while close-on-outside is on.
  • Losing focus to something outside the popover (via Tab) closes it the same way.

Keyboard #

Key Action
EscCloses the popover and returns focus to the trigger.
TabMoves focus to the next focusable element. Because the popover isn’t modal, focus can leave it — doing so closes it while `close-on-outside` is on.