# @leafygreen-ui/portal

> LeafyGreen UI Kit Portal

Latest version **7.1.1** (published 2026-10-02) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @leafygreen-ui/portal
pnpm add @leafygreen-ui/portal
yarn add @leafygreen-ui/portal
bun add @leafygreen-ui/portal
```

## Health

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

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 7.1.1 |
| Published | 2026-10-02 |
| First published | 2019-04-17 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 53.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 274 |
| Maintainers | thesonofthomp, shaneeza, stephl3, aitchpgm, hnevins, _tsck |

## Links

- npm: https://www.npmjs.com/package/@leafygreen-ui/portal
- Repository: https://github.com/mongodb/leafygreen-ui
- Homepage: https://github.com/mongodb/leafygreen-ui/tree/main/packages/portal
- Issues: https://jira.mongodb.org/projects/PD/summary
- npm.io page: https://npm.io/package/@leafygreen-ui/portal

## Dependencies (2)

- [@leafygreen-ui/lib](https://npm.io/package/@leafygreen-ui/lib.md) ^15.7.1
- [@leafygreen-ui/hooks](https://npm.io/package/@leafygreen-ui/hooks.md) ^9.3.2

## Recent versions

- 7.1.1 (latest) — 2026-10-02
- 4.1.5 (beta) — 2023-07-26
- 5.0.0-alpha.1 (alpha) — 2023-07-20
- 4.1.3-next.7 (next) — 2023-05-26
- 4.0.5-test.0 (test) — 2022-09-22
- 7.1.0 — 2025-10-07
- 7.0.4 — 2025-09-10
- 7.0.3 — 2025-09-03
- 7.0.2 — 2025-07-03
- 7.0.1 — 2025-06-30
- 7.0.0 — 2025-05-29
- 6.0.6 — 2025-04-22
- 6.0.5 — 2025-04-02
- 6.0.4 — 2025-03-05
- 6.0.3 — 2025-03-03
- … 66 more at https://npm.io/package/@leafygreen-ui/portal/versions

## README

# Portal

![npm (scoped)](https://img.shields.io/npm/v/@leafygreen-ui/portal.svg)

#### [View on MongoDB.design](https://www.mongodb.design/component/portal/live-example/)

## Installation

### PNPM

```shell
pnpm add @leafygreen-ui/portal
```

### Yarn

```shell
yarn add @leafygreen-ui/portal
```

### NPM

```shell
npm install @leafygreen-ui/portal
```

## Example

```js
import Portal from '@leafygreen-ui/portal';

<Portal>
  <div>
    Portals transport their children to a div that is appended to the end of the
    document.body to or a node that can be specified with a container prop.
  </div>
</Portal>;
```

## Properties

| Prop        | Type       | Description                                                                                                                                                               | Default                         |
| ----------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- |
| `container` | `DOM Node` | Sets the container node, which will contain all of the portaled content. If no container is supplied, a div will be created and apened to the end of the `document.body`. | `document.createElement('div')` |
| `children`  | `node`     | The children will be rendered inside of the portaled container.                                                                                                           |                                 |

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