Overlay

Overlay & Surface
stable

Low-level overlay with portal, scrim and position management.

API

Props

All props accepted by this component, with their type, default value and description.

absolute
boolean
false
Positions the overlay absolutely within its parent instead of fixed to the viewport.
closeOnBack
boolean
true
Close the overlay when the browser back button is pressed.
contentClass
string | Array<string>
Additional CSS classes applied to the content wrapper element.
contentProps
any
Additional attributes passed directly to the content wrapper element.
disabled
boolean
false
Prevents the overlay from opening.
noClickAnimation
boolean
false
Disables the bounce animation when clicking outside a persistent overlay.
modelValue
boolean
false
Controls the visibility of the overlay (v-model).
zIndex
number | string
2000
z-index of the overlay. Overrides the automatic stacking.
disableGlobalStack
boolean
false
Opt out of the global overlay stack management.
persistent
boolean
false
Prevents closing the overlay by clicking outside or pressing Escape.
id
string
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
height
number | string
Height of the overlay content area.
maxHeight
number | string
Maximum height of the overlay content area.
maxWidth
number | string
Maximum width of the overlay content area.
minHeight
number | string
minWidth
number | string
width
number | string
Width of the overlay content area.
target
'parent' | 'cursor' | TAnyString | Element | ComponentPublicInstance | [x: number, y: number] | undefined
activator
'parent' | 'cursor' | TAnyString | Element | ComponentPublicInstance
activatorProps
any
openOnClick
boolean
openOnContextMenu
boolean
openOnHover
boolean
openOnFocus
boolean
closeOnContentClick
boolean
closeDelay
number | string
openDelay
number | string
locationStrategy
TLocationStrategy | TLocationStrategyFn
location
TAnchor
origin
TAnchor | 'auto' | 'overlap'
offset
number | string | Array<number>
viewportMargin
number
scrollStrategy
TScrollStrategy | TScrollStrategyFn
contained
boolean
eager
boolean
transition
boolean | string | TTransitionProps
'dialog-transition'
Vue transition applied when the overlay enters and leaves.
scrim
boolean | string
true
Whether to show the backdrop scrim. Pass a color string to tint it.
attach
boolean | string | Element | null
false
Teleport target. true = parent element, string = CSS selector, Element = direct reference.

API

Slots

Content slots exposed by this component.

#activator
Trigger element. Receives isActive and spread-ready props for the activator element.
#default
Content rendered inside the overlay. Receives isActive (the open state ref).

API

Emits

Events emitted by this component.

@afterEnter
void
Fired after the enter transition completes.
@afterLeave
void
Fired after the leave transition completes.
@keydown
KeyboardEvent
Fired on keydown events (used for Escape key handling).
@update:modelValue
any
Fired when the overlay opens or closes.
@click:outside
MouseEvent
Fired when the user clicks outside the overlay content.

Interactive

Playground

Edit props live and see the component update in real time. The generated code snippet updates as you change values.

Rendering the live preview…

Usage

Examples

Ready-to-paste code snippets for your templates.

Basic overlay

vue

With activator slot

vue

Persistent overlay

vue

Ecosystem

Family

Components from the same folder that share conventions and often compose together.