Overlay

Overlay & Surface
stable

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

API

Props

Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et 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

Emplacements de contenu exposés par ce composant.

#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

Événements émis par ce composant.

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

Interactif

Playground

Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.

Rendu de l’aperçu en cours…

Usage

Exemples

Extraits de code prêts à coller dans vos templates.

Basic overlay

vue

With activator slot

vue

Persistent overlay

vue

Écosystème

Famille

Composants du même dossier qui partagent les conventions et se composent souvent ensemble.