Skip to main content
You are viewing Pre-Alpha documentation.
Vuetify0 Logo
Theme
Mode
Palettes
Accessibility
Vuetify One

Sign in to Vuetify One

Access premium tools across the Vuetify ecosystem — Bin, Play, Studio, and more.

Not a subscriber? See what's included

usePopover

A composable for native popover API behavior with CSS anchor positioning.


IntermediateMar 19, 2026

Usage

usePopover manages a popover’s open/close state, generates CSS anchor positioning styles, and synchronizes reactive state with native popover toggle events. Spread anchorStyles on the activator, contentAttrs and contentStyles on the content element, and call attach() to wire up the native popover lifecycle.

vue
<script setup lang="ts">
  import { usePopover } from '@vuetify/v0'
  import { useTemplateRef } from 'vue'

  const content = useTemplateRef('content')

  const {
    isOpen,
    toggle,
    attach,
    anchorStyles,
    contentAttrs,
    contentStyles,
  } = usePopover({ positionArea: 'bottom' })

  attach(content)
</script>

<template>
  <button :style="anchorStyles" @click="toggle">
    {{ isOpen ? 'Close' : 'Open' }}
  </button>

  <div
    ref="content"
    v-bind="contentAttrs"
    :style="contentStyles"
  >
    Popover content
  </div>
</template>

Architecture

usePopover builds on useEventListener for native toggle event synchronization. It is a standalone composable — not part of the compound Popover component — making it ideal for building select, combobox, tooltip, and menu components directly.

Popover Architecture

Use controls to zoom and pan. Click outside or press Escape to close.

Popover Architecture

Reactivity

Property/MethodReactiveNotes
isOpenShallowRef, tracks whether the popover is open
open()-Open the popover
close()-Close the popover
toggle()-Toggle open/close
attach(el)-Wire native show/hide watch + toggle event sync to a content element
anchorStylesReadonly Ref, CSS anchor-name for the activator element
contentAttrsReadonly Ref, id and popover attribute for the content element
contentStylesReadonly Ref, CSS anchor positioning styles for the content element

API Reference

The following API details are for the usePopover composable.

Functions

usePopover

(options?: PopoverOptions) => PopoverReturn

Options

id

string | undefined

Auto-generated if not provided

positionArea

string | undefined

CSS position-area value

Default: 'bottom'

positionTry

string | undefined

CSS position-try-fallbacks value

Default: 'most-width bottom'

isOpen

Ref<boolean, boolean> | undefined

External ref for bidirectional open state (e.g., from defineModel)

Was this page helpful?

© 2016-1970 Vuetify, LLC
Ctrl+/