Checkbox

A single checkbox, and a group of checkboxes bound to a list.

The server echoes whether the box is checked.

Open in new tab

Each preview is its own Live page in a frame, because this site is a Vue 3.5 app built on the Pulsar starter kit. An open list or popover stays inside its frame; in your application it opens over the page.

Installation

bash
suprnova live:add checkbox

Usage

html
{% import "suprnova-ui/checkbox/checkbox.html" as checkbox %}
{% call checkbox::checkbox("agree", "I agree to the terms", checked=agree) %}{% endcall %}

Examples

Group

A group bound to a list; the server names the choices.

Open in new tab

Keyboard and accessibility

suprnova.checkbox - one native checkbox with its label; checked is the island's current value (FORM-009). checkbox_group renders a fieldset of checkboxes over (value, label) pairs bound to a collection model path: selected is the island's current list, whose boxes render checked, and the runtime proposes the list of checked values (LIVE-032), whatever the number of options, because each box carries data-suprnova-live-collection. Each box is keyed by its value, so a choice the user has not sent survives a re-render of the island (FORM-010). authority marks a server correction (Live spec 12).

API reference

checkbox

ParameterDefaultDescription
nameRequiredThe `bool` model field.
labelRequiredThe text beside the box.
requiredfalseMarks the control required.
checkedfalseThe island's current value of the field, so the control shows it.
authority""A correction sequence. When set, this render replaces the visitor's unsent edit.

checkbox_group

ParameterDefaultDescription
nameRequiredThe `Vec<String>` model field.
legendRequiredThe group's legend.
optionsRequired`(value, label)` pairs, one checkbox each.
selectedRequiredThe island's current list, so the chosen boxes show checked.
authority""A correction sequence. When set, this render replaces the visitor's unsent edit.