Skip to main content
InterviewHubPRO
Section Overview
Q12

Question 12 of 50

Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

24%
Vue.js & Composition API (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

What is the native `<Teleport>` component?

junior LevelCode ExampleComponents

In Simple Words: Allows you to render a component's DOM subtree into a different location in the DOM outside the component hierarchy (typically body), while preserving the component's logical parent-child state and event communication:

vue
<template>
  <button @click="isOpen = true">Open Modal</button>
  <Teleport to="body">
    <div v-if="isOpen" class="modal-overlay">
      <div class="modal-content">Modal rendered in body!</div>
    </div>
  </Teleport>
</template>

Prevents modals and tooltips from being clipped by parent CSS overflow: hidden or z-index stacking contexts.