-
Notifications
You must be signed in to change notification settings - Fork 0
Basic Syntax
Brandon Jordan edited this page Jul 9, 2023
·
13 revisions
Components are functions stacked on top of each other in an array separated by commas.
jsUI.view([
Component(),
Component(),
// …
]);
To apply styles to a component, simply add the corresponding method using dot notation.
Component()
.propertyMethod()
Most elements accept an array of elements as their first or second argument which means that that element can nest elements inside itself.
Div([
Paragraph("Text")
])
Resulting HTML:
<div>
<p>Text</p>
</div>
This may change in the future, but some elements only accept arguments, like Text()
, Hyperlink()
, Button()
, etc. accept the most used attribute as a convenient shorthand
Example
The Hyperlink()
element accepts optional text and URL arguments. While these can also be set using it's url()
and text()
methods, if all you need to do is set these common arguments, so there's no need to chain methods.
Hyperlink("Link Text", "https://example.com")