📄 radixui/primitives/docs/utilities/portal

File: portal.md | Updated: 11/15/2025

Source: https://www.radix-ui.com/primitives/docs/utilities/portal

Radix Homepage

Made by WorkOS

Radix Homepage

Made by WorkOS

ThemesThemes PrimitivesPrimitives IconsIcons ColorsColors

Documentation Case studies Blog

Search

/

Overview

Introduction Getting started Accessibility Releases

Guides

Styling Animation Composition Server-side rendering

Components

Accordion Alert Dialog Aspect Ratio Avatar Checkbox Collapsible Context Menu Dialog Dropdown Menu Form

Preview
Hover Card Label Menubar Navigation Menu One-Time Password Field

Preview
Password Toggle Field

Preview
Popover Progress Radio Group Scroll Area Select Separator Slider Switch Tabs Toast Toggle Toggle Group Toolbar Tooltip

Utilities

Accessible Icon Direction Provider Portal Slot Visually Hidden

Utilities

Portal

Renders a React subtree in a different part of the DOM.

Features

Render any React subtree outside of your App.

Appends to `document.body` by default but can be customized to use a different container.

Installation


Install the component from your command line.

npm install @radix-ui/react-portal

Anatomy


Import the component.

import { Portal } from "radix-ui";

export default () => <Portal.Root />;

Basic example


Use the portal primitive.

import { Portal } from "radix-ui";

export default () => <Portal.Root>Content</Portal.Root>;

API Reference


Root

Anything you put inside this component will be rendered in a separate <div> element. By default, this element will be appended to document.body but you can choose a different container by using the container prop.

| Prop | Type | Default | | --- | --- | --- | | asChild<br><br>Prop description | boolean | false | | container<br><br>Prop description | HTMLElement | No default value |

PreviousDirection Provider

NextSlot

Edit this page on GitHub.