Skip to content

Basic Syntax

Brandon Jordan edited this page Sep 15, 2022 · 13 revisions

Components

Components are functions stacked on top of each other in an array separated by commas.

jsUI.view([
    Component(),
    Component(),
    // …
]);

Styling

To apply styles to a component, simply add the corresponding method using dot notation.

Component()
    .propertyMethod()

Arguments

Some components accept arguments, like Text(), Hyperlink(), Button(), etc. accept a text argument as a convenient shorthand to the text() method.

Hyperlink("Link Text")
    .url("https://example.com")

Nesting components

The other type of argument is an array of components which means that that component can nest components inside itself.

Div([
    Paragraph("Text")
])

Resulting HTML:

<div>
    <p>Text</p>
</div>
Clone this wiki locally