empty represents an empty sequence of nodes: it is equivalent to concat []. This doesn't seem very useful at first, but it is actually important for conditional elements.

Conditional elements

Due to the way that Blazor compares the rendered DOM when a change is applied, the returned HTML must always have the same structure: conditional elements can't be simply added. For example, the following may cause runtime errors:

Asynchronous event handlers are also available in the submodules on.task and on.async. These modules contain functions that are identical to the ones directly in on, except that their callbacks return Task and Async<unit>, respectively.

Functions in bind.input bind to the value property of an element by listening to the oninput event. This means that the callback is called on every user interaction on the element that changes its value. For example, on a text input, it is triggered on every keystroke.

They are suitable for input and textarea elements.

Functions in bind.change are identical except that they listen to the onchange event. This means that the callback is called when a change is "committed" by the user. For example, on a text input, it is triggered when the user presses Enter or unfocuses the element after changing its value.

They are suitable for input, textarea and select elements.

These submodules contain functions that bind to a value with the corresponding type:

string

int

int64

float

float32

decimal

dateTime

dateTimeOffset

The number-typed functions are particularly suitable with an input that has attr.``type`` "number".

Additionally, the module bind directly contains a function checked which binds to the checked property of a checkbox input. Note that you also need to add attr.``type`` "checkbox" to the input.