--- title: Portal description: "`Portal` is a component that renders elements outside of the current `DOM` hierarchy." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/portal --- ```tsx <> 元の世界 ナツキ・スバル ``` ## Usage ```tsx import { Portal } from "@yamada-ui/react" ``` ```tsx import { Portal } from "@/components/ui" ``` ```tsx import { Portal } from "@workspaces/ui" ``` ```tsx ``` ### Change the destination To change the destination, set the `ref` of the destination to `containerRef`. By default, it transfers to the end of `document.body`. ```tsx const containerRef = useRef(null) return ( 元の世界 ナツキ・スバル エミリアたん ) ``` ### Disable portaling To disable forwarding, set `disabled` to `true`. ```tsx <> 元の世界 ナツキ・スバル ``` ## Props | Prop | Default | Type | Description | | -------------- | ------- | -------------------------------- | ---------------------------------------------------------------- | | `containerRef` | - | `RefObject` | The `ref` to the component where the portal will be attached to. | | `disabled` | - | `boolean` | If `true`, the forwarding will be disabled. |