Components

Popover

A floating panel anchored to a trigger element.

A non-modal floating panel positioned relative to a trigger. Use it for tooltips with rich content, pickers, or contextual forms. Unlike Dialog, it doesn't trap 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.

<template>
  <Popover side="top" align="center">
    <template #trigger="{ toggle }">
      <button @click="() => toggle()">Info</button>
    </template>
    <template #content>
      <p>Appears above the button.</p>
    </template>
  </Popover>
</template>

With a close button inside

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

<template>
  <Popover>
    <template #trigger="{ toggle }">
      <button @click="() => toggle()">Filters</button>
    </template>

    <template #content="{ close }">
      <div class="popover-panel">
        <h3>Filter options</h3>
        <!-- filter controls -->
        <button @click="() => close()">Apply</button>
      </div>
    </template>
  </Popover>
</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>.

<template>
  <Popover teleport="body">
    <template #trigger="{ toggle }">
      <button @click="() => toggle()">Open</button>
    </template>
    <template #content>Content in body.</template>
  </Popover>
</template>

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.
uiPopoverUiCSS 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