← All notes

Render a Vue Teleport or a React portal outside the parent DOM tree

Answer: Vue's <Teleport> is a built-in component that sends part of a component template into a DOM node that exists outside that component's DOM hierarchy. React's createPortal does the same kind of thing: it lets you render some children into a different part of the DOM. Both are commonly used for full-screen modals.

Vue Teleport

The guide notes that a modal's button and the modal itself often belong in the same single-file component, because they share open and close state. <Teleport> keeps that logical grouping and still displays the modal elsewhere, even outside the Vue application.

React createPortal

createPortal takes the children, a DOM node, and an optional key. The children still belong to the React tree of the parent component, but they appear under the given DOM node. A modal is a common case.

| Teleport | createPortal | |---|---| | Teleport | Built-in Vue component that moves template output | | createPortal | React API that renders children elsewhere in the DOM | | modal | Common case for both APIs | | target DOM node | Exists outside the parent component hierarchy |

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Vue docs, Teleport; React docs, createPortal. CC-BY-4.0; CC-BY-4.0. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Vue docs, Teleport; React docs, createPortal. CC-BY-4.0; CC-BY-4.0.

Cite this

Permanent ID: iil:note:rry0tggh

iinventedlight. 2026. "Render a Vue Teleport or a React portal outside the parent DOM tree." iinventedlight Library, iil:note:rry0tggh, version of 2026-11-19. https://iinventedlight.com/library/notes/vue-teleport/. License: CC-BY-4.0.

@misc{iil_note_rry0tggh,
  author = {{iinventedlight}},
  title = {{Render a Vue Teleport or a React portal outside the parent DOM tree}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-19},
  url = {https://iinventedlight.com/library/notes/vue-teleport/},
  note = {Permanent ID iil:note:rry0tggh. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/vue-teleport.md.