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:
import { JPopover } from '@juxtui/ui'Usage #
<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
| Prop | Type | Default | Description |
|---|---|---|---|
| open | boolean | false | Bound with v-model:open. |
| placement | Placement | 'bottom' | Preferred side and alignment. Flips when there isn’t room. |
| offset | number | 8 | Distance from the trigger in px. |
| ariaLabel | string | — | Accessible name of the popover content. |
| closeOnOutside | boolean | true | Close when focus or a click leaves the popover. |
| disabled | boolean | false | Prevent opening. |
Events
| Event | Payload | Description |
|---|---|---|
| update:open | boolean | Emitted when the popover opens or closes. |
Slots
| Slot | Props | Description |
|---|---|---|
| trigger | { open } | The element that opens the popover. |
| default | { close } | Popover content. |
Methods
| Method | Signature | Description |
|---|---|---|
| close() | () => void | Close the popover and return focus to the trigger. |
Accessibility #
role="dialog"withoutaria-modal; the trigger getsaria-haspopup="dialog",aria-expandedandaria-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-outsideis on. - Losing focus to something outside the popover (via Tab) closes it the same way.
Keyboard #
| Key | Action |
|---|---|
| Esc | Closes the popover and returns focus to the trigger. |
| Tab | Moves 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. |