Skip to content

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

Notifications You must be signed in to change notification settings

acrool/acrool-react-portal

Repository files navigation

Acrool React Portal

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

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

License

MIT © Acrool & Imagine

About

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

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published