Button
Buttons that change state. A button names a reactive value and how to change it, and pressing it
performs that change. This is reversibility: any value can be set, and a button is a place a set happens. Each
button takes a content closure for its label. These build on
Dom.Event.Set.
Contents
Functions
Functions
Button.Integer.Decrement
A button that subtracts one from an integer value when pressed.
Parameters
| Name | Type | Description |
|---|---|---|
settable | Reactive number | The integer to lower by one. |
content | function | A closure for the button's label. |
Example
const count = Reactive.State(Maths.Integer)(10);
Button.Integer.Decrement(count, () => {
Content.Text("Down");
});Button.Integer.Increment
A button that adds one to an integer value when pressed.
Parameters
| Name | Type | Description |
|---|---|---|
settable | Reactive number | The integer to raise by one. |
content | function | A closure for the button's label. |
Example
const count = Reactive.State(Maths.Integer)(0);
Button.Integer.Increment(count, () => {
Content.Text(`Clicked ${count.value} times`);
});Button.Set
A button that sets a value to a fixed new value when pressed.
Parameters
| Name | Type | Description |
|---|---|---|
settable | Reactive value | The value to set. |
newValue | any | What to set it to when the button is pressed. |
content | function | A closure for the button's label. |
Example
const open = Reactive.State(Logic.Maybe)(false);
Button.Set(open, true, () => {
Content.Text("Open");
});