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
- id: C1 claim: Teleport is a built-in Vue component that moves part of a template to a DOM node outside the component's tree. source: S1 evidence: "built-in component that allows us"
- id: C2 claim: The target node can exist outside the Vue application's DOM hierarchy. source: S1 evidence: "DOM node that exists outside"
- id: C3 claim: React's createPortal renders children into a different part of the DOM. source: S2 evidence: "render some children into a different part of the DOM"
Sources
- [S1] Teleport. Vue docs. https://vuejs.org/guide/built-ins/teleport.html . License: CC-BY-4.0. Accessed 2026-11-19.
- [S2] createPortal. React docs. https://react.dev/reference/react-dom/createPortal . License: CC-BY-4.0. Accessed 2026-11-19.
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
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.},
}
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.
- vue-teleport.table.json (table; CC-BY-4.0)
- vue-teleport.schema.json (schema; CC-BY-4.0)
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.