Collection of base components following the component interface of modapp.
With npm:
npm install modapp-base-component
With yarn:
yarn add modapp-base-component
Import any selected component and use it.
import { Txt } from 'modapp-base-component';
let txt = new Txt("Hello World!");
txt.render(document.body);
All components follows modapp's component interface:
A UI component
Kind: global interface
- Component
- .render(el) ⇒
HTMLElement
|DocumentFragment
|null
- .unrender()
- .render(el) ⇒
Renders the component by appending its own element(s) to the provided parent element.
The provided element is not required to be empty, and may therefor contain other child elements.
The component is not required to append any element in case it has nothing to render.
Render is never called two times in succession without a call to unrender in between.
Kind: instance method of Component
Returns: HTMLElement
| DocumentFragment
| null
- Element or document fragment appended to el. May be null or undefined if no elements was appended.
Param | Type | Description |
---|---|---|
el | HTMLElement | DocumentFragment |
Parent element in which to render the contents |
Unrenders the component and removes its element(s) from the parent element.
Only called after render and never called two times in succession without a call to render in between.
Kind: instance method of Component