2.0.0 • Published 5 years ago

mithril-portal v2.0.0

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

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

import m from 'mithril';
import Portal from 'mithril-portal';

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

API

AttributeDescription
onContentMount(rootElement: HTMLElement) => voidCallback invoked when the portal has mounted.
container: HTMLElementOptional element to mount to (default is document.body)
2.0.0

5 years ago

1.2.1

5 years ago

1.2.0

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago