@acrool/react-portal
Version:
Portal library based for Reactjs
75 lines (47 loc) • 2.62 kB
Markdown
# Acrool React Portal
<a href="https://acrool-react-portal.pages.dev/" title="Acrool React Portal - Throw React elements (ex: modal, dialog, toaster) to external using elements (usually used for">
<img src="https://raw.githubusercontent.com/acrool/acrool-react-portal/main/example/public/og.png" alt="Acrool React Portal Logo"/>
</a>
<p align="center">
Throw React elements (ex: modal, dialog, toaster) to external using elements (usually used for
</p>
<div align="center">
[](https://www.npmjs.com/package/@acrool/react-portal)
[](https://github.com/acrool/@acrool/react-portal/blob/main/LICENSE)
[](https://github.com/acrool/react-portal/blob/main/LICENSE)
[](https://www.npmjs.com/package/@acrool/react-portal)
[](https://www.npmjs.com/package/@acrool/react-portal)
</div>
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
```bash
yarn add @acrool/react-portal
```
## Usage
add in your App.tsx
```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:
[](https://acrool-react-dialog.pages.dev)
[](https://acrool-react-modal.pages.dev)
[](https://acrool-react-toaster.pages.dev)
## With application
- [Acrool React Dialog](https://github.com/acrool/acrool-react-dialog)
- [Acrool React Toaster](https://github.com/acrool/acrool-react-toaster)
- [Acrool React Picker](https://github.com/acrool/acrool-react-picker)
## License
MIT © [Acrool](https://github.com/acrool) & [Imagine](https://github.com/imagine10255)