npm explorer

@chakra-ui/portal

v2.1.0TypeScript

React component used to render children outside the DOM hierarchy of the parent component

reactportalnested portalz-indexlayerchakra ui
0/weekUpdated 5 months agoMITUnpacked: 50.7 KB
Published by Segun Adebayo
npm install @chakra-ui/portal
RepositoryHomepagenpm

@chakra-ui/portal

A wrapper for rendering components in React Portals, with support for nested
portals and stacking.

Installation

``sh
yarn add @chakra-ui/portal

or

npm i @chakra-ui/portal
`

Import components

`jsx
import { Portal, PortalManager } from "@chakra-ui/portal"
`

Render the PortalManager once at the root of your application

`jsx
function App() {
return (


{/ Your app goes here /}

)
}
`

$3

Portals are render into the portal manager's node by default not
document.body.

`jsx


Welcome


This text has been portaled

`

$3

Nesting portal can be very useful to build complex widgets like nested menu,
popovers, modal, etc.

`jsx

This is a portal.
This is a nested portal

`

$3

You can also portal elements into a custom containers. Simply pass a
containerRef prop that points to the node of that element.

`jsx
<>



Hello world




``

@chakra-ui/portal - npm explorer

Dist Tags

canary1.0.0-next.0
pr0.0.0-pr-202212011232
next2.0.0-next.3
dev0.0.0-dev-20230718132637
latest2.1.0