Skip to content

Logic Components

Brandon Jordan edited this page Sep 3, 2023 · 7 revisions

This component provides methods of adding conditional rendering logic.

If

If is a simple conditional component.

Example:

// ...
Div([
    If(variable, [
        Paragraph("Hey! 'variable' evaluates to true :)")
    ]),
]),
// ...

You can add Else and ElseIf methods to chain conditional logic.

Example:

// ...
Div([
    If(variable, [
        Paragraph("Hey! 'variable' evaluates to true :)")
    ]).Else([
        Paragraph("Hey! 'variable' evaluates to false :(")
    ])
]),
// ...
// ...
Div([
    If(variable, [
        Paragraph("Hey! 'variable' evaluates to true :)")
    ]).ElseIf(variable === "hello, world!", [
        Paragraph("Hey! 'variable' evaluates to false :(")
    ])
]),
// ...

Switch

Example:

// ...
Div([
    Switch(n)
        .Case(1, [
            // ...
        ])
        // ...
        .Default([
            // ...
        ])
    .EndSwitch()
]),
// ...

Device

Device is an object with the following methods

  • Mobile(components)
  • Mobile(components)
  • Small(components)
  • Medium(components)
  • Large(components)
Device.Mobile([
    Paragraph("Hello, Mobile User :)")
])
Clone this wiki locally