Using Vue Teleport for Modals and Tooltips
Vue's Teleport component renders content into a different DOM location while preserving the component tree. It's the cleanest answer to modals, tooltips, and overlays.
Modals and tooltips have a layout problem. They need to appear above everything else on the page (z-index, positioning), but they are usually triggered from deep inside a component tree. Vue's Teleport solves this directly.
What Teleport does
Teleport moves rendered DOM to a different element while keeping the Vue component tree intact. So a modal can be defined inside a deeply nested component but its actual DOM lives at the bottom of the body, where it can sit above everything else without z-index gymnastics.
html<template>
<button @click="open = true">Open</button>
<Teleport to="body">
<div v-if="open" class="modal">
<!-- modal contents -->
</div>
</Teleport>
</template>Why this is better than the alternatives
Without Teleport, modals end up in the same overflow context as their parent. Hidden parent overflow? The modal gets clipped. Transformed parent? The modal positions wrong. With Teleport, the modal renders at the body level and sidesteps all of that.
And the component tree behaves normally — events bubble through the parent that defines the modal, even though the DOM is elsewhere. From a Vue perspective, the modal is still a child component.
When to skip it
Inline tooltips that should follow scroll, dropdowns inside scrollable containers, and any UI that should be clipped by its parent should not use Teleport. The point of Teleport is to escape layout — only use it when escaping is what you want.
About the author

Richard Gamora
Fullstack developer based in the Philippines, working mostly with Laravel and Vue.js, with eight years of production experience across web and mobile.
More on Vue & Nuxt
January 28, 2026
Vue 3 Composition API: Patterns That Scale
The Composition API is more flexible than the Options API but easier to misuse. Here are the patterns that hold up as components grow.
January 21, 2026
Migrating from Vuex to Pinia: A Practical Guide
Pinia is now the recommended state library for Vue 3. Here's how to migrate from Vuex incrementally without breaking working code.
January 14, 2026
Nuxt 3 SSR vs SSG: How to Decide for Your Site
Nuxt 3 supports server rendering, static generation, and hybrid modes per route. Here's a clear way to choose for content sites, SaaS apps, and marketing pages.