Skip to content

Popover

A floating panel anchored to a trigger element.

Popover positions a non-modal panel next to its trigger. It supports rich hints, pickers, and contextual forms without trapping focus.

Anatomy

  • #trigger: Element that opens the popover.
  • #content: Floating panel content.

Usage

Examples

Positioned to the top

Use side and align to control where the panel appears relative to the trigger.

vue
@layer akaza-reset;
@import "tailwindcss";
@import "akaza-ui/dist/akaza-ui.css";

With a close button inside

Use the content slot's close function for actions inside the panel.

vue
<template>
  <Avatar
    src="/avatar.jpg"
    alt="Jane Doe"
    text="JD"
    :delay-ms="300"
  />
</template>

Enable teleport

By default the popover stays in the DOM tree next to its trigger. Pass teleport="body" to render the panel under <body>.

vue
<Button
  :ui="{
    root: 'rounded-md bg-black px-3 py-2 text-white',
    spinner: 'size-4 animate-spin',
  }"
>
  Save
</Button>

API Reference

Props

PropTypeDefaultDescription
side"top" | "bottom" | "left" | "right""bottom"Preferred side to position the popover.
align"start" | "center" | "end""start"Alignment relative to the trigger.
sideOffsetnumber6Gap in px between trigger and panel.
teleportstring | falsefalseTeleport target.
transitionstring | false"akaza-popover"Named Vue transition.
uiPopoverUi—CSS class overrides.

Slots

SlotScoped propsDescription
trigger{ isOpen, open, close, toggle, triggerProps }Element that opens the popover.
content{ close }The floating panel content.

Exposed methods

MethodSignatureDescription
open(reason?, event?) => voidOpens the popover.
close(reason?, event?) => voidCloses the popover.
toggle(reason?, event?) => voidToggles the popover.

Emits

EventPayloadDescription
open-change[open: boolean, details]Fired when the open state changes.

UI Options

KeyDescription
rootTrigger wrapper/root.
contentThe floating panel element.

Styling Hooks

UI keyCSS classData attrs
rootakaza-popover-rootdata-akaza-state
contentakaza-popover-contentdata-akaza-state, data-akaza-side, data-akaza-align

Positioning Variables

The panel updates when its trigger or content resizes, and on viewport scroll or resize. Placement can switch sides to fit the viewport.

VariableMeaning
--akaza-popover-anchor-widthAnchor width in pixels.
--akaza-popover-anchor-heightAnchor height in pixels.
--akaza-popover-available-widthViewport width after collision padding.
--akaza-popover-available-heightViewport height after collision padding.
--akaza-popover-transform-originOrigin matching the resolved side and alignment.

Keyboard

KeyBehavior
Enter / SpaceOpens when trigger is a native button wired to toggle.
EscapeCloses topmost popover and restores trigger focus.
Tab / Shift + TabUses normal document order; Popover is non-modal and does not trap focus.

Apply triggerProps to trigger element so expanded state and popup relationship are announced.

Edit this page on GitHub ↗