-
Notifications
You must be signed in to change notification settings - Fork 0
Logic Components
Brandon Jordan edited this page Sep 3, 2023
·
7 revisions
This component provides methods of adding conditional rendering logic.
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 :(")
])
]),
// ...
Example:
// ...
Div([
Switch(n)
.Case(1, [
// ...
])
// ...
.Default([
// ...
])
.EndSwitch()
]),
// ...
Device
is an object with the following methods
Mobile(components)
Mobile(components)
Small(components)
Medium(components)
Large(components)
Device.Mobile([
Paragraph("Hello, Mobile User :)")
])