An open API service indexing awesome lists of open source software.

https://github.com/acrool/acrool-react-portal

Throw React elements (ex: modal, dialog, toaster) to external using elements (usually used for
https://github.com/acrool/acrool-react-portal

Last synced: 2 months ago
JSON representation

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

Awesome Lists containing this project

README

        

# Acrool React Portal


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

[![NPM](https://img.shields.io/npm/v/@acrool/react-portal.svg?style=for-the-badge)](https://www.npmjs.com/package/@acrool/react-portal)
[![npm](https://img.shields.io/bundlejs/size/@acrool/react-portal?style=for-the-badge)](https://github.com/acrool/@acrool/react-portal/blob/main/LICENSE)
[![npm](https://img.shields.io/npm/l/@acrool/react-portal?style=for-the-badge)](https://github.com/acrool/react-portal/blob/main/LICENSE)

[![npm downloads](https://img.shields.io/npm/dm/@acrool/react-portal.svg?style=for-the-badge)](https://www.npmjs.com/package/@acrool/react-portal)
[![npm](https://img.shields.io/npm/dt/@acrool/react-portal.svg?style=for-the-badge)](https://www.npmjs.com/package/@acrool/react-portal)

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

## 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 (

{item && renderDialog()}

);
};
```

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

[![Play react-editext-example](https://raw.githubusercontent.com/acrool/acrool-react-dialog/main/play-in-example-button.svg)](https://acrool-react-dialog.pages.dev)

[![Play react-editext-example](https://raw.githubusercontent.com/acrool/acrool-react-dialog/main/play-in-example-button.svg)](https://acrool-react-modal.pages.dev)

[![Play react-editext-example](https://raw.githubusercontent.com/acrool/acrool-react-toaster/main/play-in-example-button.svg)](https://acrool-react-toaster.pages.dev)

## License

MIT © [Acrool](https://github.com/acrool) & [Imagine](https://github.com/imagine10255)