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.

Install the component from your command line.

Import the component.

Use the portal primitive.

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

PropTypeDefaultRequired
containerRefref