Text
Text is the native string type: it is both a Reactive type and a native value, and the
type name doubles as its namespace, so its functions hang directly off it. Use it to compare, join and
present text as reactive values that update on their own. The derived results are computed by a driver
and settle asynchronously, so they begin loading and fill in once their inputs are ready.
Contents
Functions
Functions
Text.Concat
Joins two text values into one reactive Text.
Parameters
| Name | Type | Description |
|---|---|---|
a | Text | The first text value; plain or reactive. |
b | Text | The second text value, appended after the first. |
Returns
A reactive Text holding a followed by b. It starts loading and settles once both operands are ready.
Example
const greeting = Text.Concat("Hello, ", name);
Content.Text(greeting);Text.Equal
A reactive boolean that is true while two text values are equal.
Parameters
| Name | Type | Description |
|---|---|---|
a | Text | The first text value; plain or reactive. |
b | Text | The second text value to compare against. |
Returns
A reactive boolean that is true exactly while a equals b, ready to drive a selection highlight or a conditional.
Example
const selected = Text.Equal(current, option);
Reactive.If(selected, () => {
Content.Text("chosen");
});Text.OrEmpty
Shows a possibly-null value as text; null renders as the empty string.
Parameters
| Name | Type | Description |
|---|---|---|
value | any | The value to show as text; plain or reactive, and may be null. |
Returns
A reactive Text of the value, or the empty string when it is null, so an unset optional slot shows blank rather than "null".
Example
const label = Text.OrEmpty(user.name);
Content.Text(label);