packages/docs/src/pages/en/components/overlays.md
v-overlay is the base for components that float over the rest of the page, such as v-menu and v-dialog. It can also be used on its own and comes with everything you need to create a custom popover component.
In its simplest form, the v-overlay component will add a dimmed layer over your application.
| Component | Description |
|---|---|
| v-overlay | Primary Component |
Overlays can be opened with v-model, or by clicking or hovering on an activator element. An activator is mandatory for the connected locationLocation strategy. The activator element (if present) will also be used by some transitions to slide or scale from the activator's location instead of the middle of the screen.
Related props:
activatoractivatorPropsopenOnClickopenOnHoveropenOnFocuscloseDelayopenDelayThe simplest way of providing an activator. Can be a CSS selector to pass to document.querySelector(), a component instance, or a HTMLElement. The string "parent" is also accepted to automatically bind to the parent element.
<v-overlay activator="#id" />
<v-overlay activator=".class" />
<v-overlay :activator="elementRef" />
<v-btn>
<v-overlay activator="parent" />
</v-btn>
For more manual control, the slot can be used instead. props is an object containing all the relevant ARIA attributes and event handlers, and must be applied to the target element with v-bind for the component to work correctly.
<v-overlay>
<template #activator="{ isActive, props }">
<v-btn v-bind="props">Overlay is {{ isActive ? 'open' : 'closed' }}</v-btn>
</template>
</v-overlay>
location-strategy="static"
Overlay content is absolutely positioned to the center of its container by default.
location-strategy="connected"
The connected strategy is used by v-menu and v-tooltip to attach the overlay content to an activator element.
location selects a point on the activator, and origin a point on the overlay content. The content element will be positioned so the two points overlap.
scroll-strategy="block"
Scrolling is blocked while the overlay is active, and the scrollbar is hidden. If contained is also set, scrolling will only be blocked up to the overlay's offsetParent.
scroll-strategy="close"
Scrolling when the overlay is active will de-activate it.
<ExamplesExample file="v-overlay/scroll-close" />scroll-strategy="reposition"
When using the connected location strategy, this scroll strategy will reposition the overlay element to always respect the activator location.
scroll-strategy="none"
No scroll strategy is used.
<ExamplesExample file="v-overlay/scroll-none" />A contained overlay is positioned absolutely and contained inside its parent element.
::: info Note: The parent element must have position: relative. :::
<ExamplesExample file="v-overlay/prop-contained" />Using the v-hover, we are able to add a nice scrim over the information card with additional actions the user can take.
<ExamplesExample file="v-overlay/misc-advanced" />Using the v-overlay as a background, add a progress component to easily create a custom loader.