Skip to main content
The to target of <Teleport> expects a CSS selector string or an actual DOM node. Nuxt currently has SSR support for teleports to #teleports only, with client-side support for other targets using a <ClientOnly> wrapper.

Body Teleport

To teleport content to the special #teleports target (which has full SSR support in Nuxt):
<template>
  <button @click="open = true">
    Open Modal
  </button>
  <Teleport to="#teleports">
    <div
      v-if="open"
      class="modal"
    >
      <p>Hello from the modal!</p>
      <button @click="open = false">
        Close
      </button>
    </div>
  </Teleport>
</template>

Client-side Teleport

For other CSS selectors, wrap <Teleport> in <ClientOnly> to ensure client-side only rendering:
<template>
  <ClientOnly>
    <Teleport to="#some-selector">
      <!-- content -->
    </Teleport>
  </ClientOnly>
</template>

Props

to
string | Element
required
A CSS selector string or an actual DOM node where the content should be teleported.
For SSR support in Nuxt, use to="#teleports". Other targets require wrapping in <ClientOnly>.
disabled
boolean
default:"false"
When true, the content will not be teleported and will remain in its original location.

Learn More

Vue Teleport Documentation

Read more about the <Teleport> component in Vue’s official documentation.