Skip to content

MazPopover

MazPopover is a versatile Vue component for displaying content in overlays that bypass overflow constraints of parent elements

Basic usage

Adaptive trigger

The adaptive trigger mode automatically adapts to the user's device:

  • Desktop: Uses hover behavior (mouseenter/mouseleave)
  • Mobile/Touch devices: Uses click behavior

This provides the best user experience across all devices without requiring manual configuration.

Positions

TIP

The position prop is used to position the popover relative to the trigger. The chosen position will force the popover to be displayed in the chosen position.

Advanced positions

Prefer position and fallback position

TIP

The prefer-position and fallback-position props are used to position the popover relative to the trigger. The prefer-position is the position that will be used if it's available, and the fallback-position is the position that will be used if the prefer-position is not available.

When you not specify a fallback position, the popover will fallback on the best position available.

Colors

Tooltip role

A directive is available to more easily add a tooltip to an element, see vTooltip for more information.

Hover this text

Controlled popover

Popover is closed

Keep open on hover

With this option, the popover will stay open when you hover over it (a timeout is used to close the popover after a certain time).

Form example

Configuration options

Persistent (no auto-close)

Custom offset

Custom styling

Disabled state

Events

Event Log:

No events yet. Try opening the popover above.

Position values

  • auto - Automatically choose best position
  • top, bottom, left, right - Basic positions
  • top-start, top-end - Top with start/end alignment
  • bottom-start, bottom-end - Bottom with start/end alignment
  • left-start, left-end - Left with start/end alignment
  • right-start, right-end - Right with start/end alignment

Accessibility

MazPopover follows WAI-ARIA guidelines:

  • Focus management: Automatically manages focus when opening/closing
  • Keyboard navigation: Supports Escape key and Tab navigation
  • ARIA attributes: Proper role, aria-modal, aria-labelledby, etc.
  • Screen reader support: Appropriate roles for different use cases

Best practices

  • Use role="tooltip" for simple informational overlays
  • Use role="dialog" for interactive content
  • Provide meaningful aria-labelledby or aria-describedby attributes
  • Ensure trigger elements are focusable and have proper labels

Props

NameDescriptionTypeRequiredDefaultPossible values
model-valuev-model
Controls the popover open state
booleanNofalse-
positionPosition of the popover relative to trigger

Position of the popover relative to trigger
MazPopoverPositionNoautoauto, top, bottom, left, right, top-start, top-end, bottom-start, bottom-end, left-start, left-end, right-start, right-end
prefer-positionPreferred position of the popover relative to trigger when auto position is used

Preferred position of the popover relative to trigger
MazPopoverPreferPositionNobottom-startauto, top, bottom, left, right, top-start, top-end, bottom-start, bottom-end, left-start, left-end, right-start, right-end
fallback-positionFallback position of the popover relative to trigger when prefer position is not visible

Fallback position of the popover relative to trigger
MazPopoverFallbackPositionNoautoauto, top, bottom, left, right, top-start, top-end, bottom-start, bottom-end, left-start, left-end, right-start, right-end
triggerHow the popover is triggered

How the popover is triggered. 'adaptive' uses hover on desktop and click on mobile
MazPopoverTriggerNoclickclick, hover, manual, adaptive
roleARIA role for accessibility

ARIA role for accessibility
MazPopoverRoleNodialogdialog, tooltip
aria-labelARIA label for the popoverstringNoundefined-
announce-changesAnnounce content changes to screen readersbooleanNofalse-
disabledDisables the popover

Disables the popover
booleanNofalse-
offsetDistance between trigger and popover in pixelsnumberNo8-
delayDelay before showing/hiding in millisecondsnumberNo0-
hover-delayDelay before closing on hover in millisecondsnumberNo150-
transitionCSS transition name for animations"scale-pop" | "scale-fade" | stringNopopover-
teleport-toTeleport target selectorstringNobody-
overlay-classAdditional CSS classes for the overlay wrapperNative typeNoundefined-
panel-classAdditional CSS classes for the popover panelNative typeNoundefined-
panel-styleInline styles for the popover panelNative typeNoundefined-
close-on-click-outsideClose popover when clicking outsidebooleanNotrue-
close-on-escapeClose popover when pressing Escape keybooleanNotrue-
persistentPrevent auto-close (ignores click outside and escape key)booleanNofalse-
idCustom ID for the popover elementstringNoundefined-
aria-labelledbyARIA labelledby attribute for accessibilitystringNoundefined-
aria-describedbyARIA describedby attribute for accessibilitystringNoundefined-
colorColor variant of the popoverMazColor | "background"Nobackgroundprimary, secondary, accent, info, success, warning, destructive, contrast, background
trap-focusTrap focus inside the popoverbooleanNotrue-
keep-open-on-hoverKeep popover open when hovering over the panelbooleanNofalse-
blockThe popover will be full width of the triggerbooleanNofalse-
position-referenceCSS selector or element reference to use for positioning calculations

When provided, the popover will position relative to this element instead of the trigger Useful for components with labels where you want to position relative to the actual input

Example: "input" or "#my-input" or HTMLElement
string | HTMLElementNoundefined-

Events

Event namePropertiesDescription
update:model-valuevalue boolean - The new open stateEmitted when popover state changes
openEmitted when popover opens
closeEmitted when popover closes
after-close-animationEmitted after the close animation
togglevalue boolean - The new open stateEmitted when popover toggles

Slots

NameDescriptionBindings
triggerTrigger element contentopen function - Function to open the popover
close function - Function to close the popover
toggle function - Function to toggle the popover
is-open boolean - Current open state of the popover
trigger 'click' | 'hover' | 'manual' - The trigger type
defaultPopover contentopen function - Function to open the popover
close function - Function to close the popover
toggle function - Function to toggle the popover
is-open boolean - Current open state of the popover

Expose

open

Open the popover
@description Programmatically open the popover
@usage mazPopoverInstance.value?.open()

close

Close the popover
@description Programmatically close the popover
@usage mazPopoverInstance.value?.close()

toggle

Toggle the popover
@description Programmatically toggle the popover open/close state
@usage mazPopoverInstance.value?.toggle()

isOpen

Check if the popover is open
@description Reactive reference to the popover open state
@usage const isPopoverOpen = mazPopoverInstance.value?.isOpen

updatePosition

Update the popover position
@description Manually recalculate and update the popover position
@usage mazPopoverInstance.value?.updatePosition()