Skip to content
Brandon Jordan edited this page Sep 10, 2023 · 14 revisions

Welcome to the jsUI wiki!

Getting Started

Install via NPM:

npm i javascript-ui

At the base of jsUI is its element abstraction built on top of the JavaScript DOM abstraction.

Import and use the view() function to start.

import {view} from 'javascript-ui';

view([
    // nest elements...
]);

Import and use built-in elements based on standard HTML tags:

import {view, Section, Paragraph} from 'javascript-ui';

view([
    Section([
        Paragraph("Text")
    ])
]);

This results in the following HTML being added to the body:

<section>
    <p>Text</p>
</section>

To add style, events, etc. you chain methods onto the element function.

import {view, Paragraph} from 'javascript-ui';

view([
    Paragraph("Text")
        .textColor("green")
]);

Resulting in:

<p style="color: green">Text</p>
Clone this wiki locally