# mithril-portal

> Mithril component for rendering children outside the DOM hierarchy of the parent component.

Latest version **2.0.0** (published 2019-10-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install mithril-portal
pnpm add mithril-portal
yarn add mithril-portal
bun add mithril-portal
```

## Health

**Score 30/100 (F)** — status: abandoned.

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2019-10-11 |
| First published | 2017-03-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 14.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Author | Vasil Rimar |
| Maintainers | vrimar |
| Keywords | mithril, portal |

## Links

- npm: https://www.npmjs.com/package/mithril-portal
- Repository: https://github.com/vasilrimar/mithril-portal
- Homepage: https://github.com/vasilrimar/mithril-portal#readme
- Issues: https://github.com/vasilrimar/mithril-portal/issues
- npm.io page: https://npm.io/package/mithril-portal

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^1.10.0

## Recent versions

- 2.0.0 (latest) — 2019-10-11
- 1.2.1 — 2019-06-05
- 1.2.0 — 2018-09-18
- 1.1.3 — 2018-01-27
- 1.1.2 — 2017-12-19
- 1.1.1 — 2017-11-16
- 1.1.0 — 2017-10-19
- 1.0.3 — 2017-05-12
- 1.0.2 — 2017-03-31

## README

# Mithril-Portal

Mithril component for rendering children outside the DOM hierarchy of the parent component.

## Why

Mithril-portal mounts a component/children to a `div` that is appended to `document.body`. This is useful for UI related components such as modals, popovers, dropdowns, etc. where rendering inline would cause css overflow/z-index issues.

## Installation

```
npm install --save mithril-portal
```

## Usage
```javascript
import m from 'mithril';
import Portal from 'mithril-portal';

const Page = {
  view() {
    return m('', [
      m(Portal, m('h1', 'Children'))
    ])
  }
}
```

## API

| Attribute                    	| Description                                                                               	|
|-----------------------------	|-------------------------------------------------------------------------------------------	|
| onContentMount(rootElement: HTMLElement) => void 	| Callback invoked when the portal has mounted. 	|
| container: HTMLElement 	| Optional element to mount to (default is `document.body`) 	|

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