Skip to content

acrool/acrool-react-portal

Repository files navigation

Acrool React Portal

Acrool React Portal Logo

Throw React elements (ex: modal, dialog, toaster) to external using elements (usually used for

NPM npm npm

npm downloads npm

https://react.dev/reference/react-dom/createPortal

^1.1.0 support react >=18.0.0 <20.0.0

Features

  • Pass the component to the external Dom through the portal

Install

yarn add @acrool/react-portal

Usage

add in your App.tsx

import ReactPortal from '@acrool/react-portal';

const App = () => {
    return (
        <ReactPortal
            id="acrool-react-modal"
            className={styles.root}
        >
            {item && renderDialog()}
        </ReactPortal>
    );
};

There is also a example that you can play with it:

Play react-editext-example

Play react-editext-example

Play react-editext-example

With application

License

MIT © Acrool & Imagine

About

Throw React elements (ex: modal, dialog, toaster) to external using elements (usually used for

Topics

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published