Skip to content

Popover

Open a floating panel beside a button or another control.

Demos

Size

Usage

vue
<script setup lang="ts">
import { Accordion } from '~/components/ui/accordion'

const items = [
  { value: 'source', label: 'Do I own the source?', content: 'Yes. Copy and adapt the files.' },
]
</script>

<template>
  <Accordion :items="items" />
</template>

Installation

Complete the shared installation. Copy Popover.vue and index.ts into app/components/ui/popover/.

API

Variants and defaults

PropValuesDefault
sizexs, sm, md, lg, xlmd

Width fits the content by default, capped at 20rem and the viewport. Panel padding stays at 12px across sizes. size controls text size, line height, and corner radius. The default trigger gap is 4px. Use class or ui.content to set an explicit width when needed. Child components retain their own size props.

Props

PropTypeDefaultDescription
side"top" | "bottom" | "left" | "right""bottom"Preferred side to position the popover.
align"start" | "center" | "end""start"Alignment relative to the trigger.
sideOffsetnumber4Gap 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.

Events

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

Exposed methods

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

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.