# @rc-component/portal

> React Portal Component

Latest version **2.2.1** (published 2026-06-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install @rc-component/portal
pnpm add @rc-component/portal
yarn add @rc-component/portal
bun add @rc-component/portal
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.2.1 |
| Published | 2026-06-05 |
| First published | 2022-09-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=12.x |
| Dependencies | 2 |
| Unpacked size | 31 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 27 |
| Author | smith3816@gmail.com |
| Maintainers | zombiej, afc163, madccc, peachscript, chenshuai2144 |
| Keywords | react, react-component, react-portal |

## Links

- npm: https://www.npmjs.com/package/@rc-component/portal
- Repository: https://github.com/react-component/portal
- Issues: https://github.com/react-component/portal/issues
- npm.io page: https://npm.io/package/@rc-component/portal

## Dependencies (2)

- [clsx](https://npm.io/package/clsx.md) ^2.1.1
- [@rc-component/util](https://npm.io/package/@rc-component/util.md) ^1.11.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.2.1 (latest) — 2026-06-05
- 2.2.0 — 2025-12-31
- 2.1.3 — 2025-12-29
- 2.1.2 — 2025-12-25
- 2.1.1 — 2025-12-24
- 2.1.0 — 2025-12-23
- 2.0.1 — 2025-11-26
- 2.0.0 — 2025-02-24
- 1.1.2 — 2023-07-19
- 1.1.1 — 2023-03-28
- 1.1.0 — 2022-12-21
- 1.0.3 — 2022-11-10
- 1.0.2 — 2022-11-04
- 1.0.1 — 2022-11-02
- 1.0.0 — 2022-10-28
- … 10 more at https://npm.io/package/@rc-component/portal/versions

## README

# rc-portal

React 18 supported Portal Component.

[![NPM version][npm-image]][npm-url] [![dumi](https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square)](https://github.com/umijs/dumi) [![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![npm download][download-image]][download-url]

[npm-image]: http://img.shields.io/npm/v/rc-portal.svg?style=flat-square
[npm-url]: http://npmjs.org/package/rc-portal
[github-actions-image]: https://github.com/react-component/portal/workflows/CI/badge.svg
[github-actions-url]: https://github.com/react-component/portal/actions
[codecov-image]: https://img.shields.io/codecov/c/github/react-component/portal/master.svg?style=flat-square
[codecov-url]: https://app.codecov.io/gh/react-component/portal
[download-image]: https://img.shields.io/npm/dm/rc-portal.svg?style=flat-square
[download-url]: https://npmjs.org/package/rc-portal

## Development

```bash
npm install
npm start
open http://localhost:8000
```

## Feature

- React life cycle support portal component

## Install

[![rc-portal](https://nodei.co/npm/rc-portal.png)](https://npmjs.org/package/rc-portal)

## Usage

```js | pure
import Portal from '@rc-component/portal';

const Demo = () => {
  return <Portal open>Hello World</Portal>;
};

export default Demo;
```

## 🔥 API

We use typescript to create the Type definition. You can view directly in IDE. But you can still check the type definition [here](https://github.com/react-component/portal/blob/master/src/interface.ts).

### Portal

| Prop         | Description                        | Type                     | Default       |
| ------------ | ---------------------------------- | ------------------------ | ------------- |
| getContainer | Customize portal container element | Element \| () => Element | document.body |
| open         | Show the portal                    | boolean                  | false         |
| autoLock     | Lock screen scroll when open       | boolean                  | false         |

---
_Source: https://npm.io/package/@rc-component/portal · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
