Checkbox Group
A group of checkboxes with shared state.
1use herogpui::components::checkbox::CheckboxGroup;Usage
Option labels use 14px/20px medium text; descriptions use 12px/16px regular text.
1use herogpui::prelude::CheckboxGroup;
2
3CheckboxGroup::new("checkbox-group", group_options())
4 .label("Notifications")Live HeroGPUI compiled to WebAssembly. Select any example without loading another WASM instance.
Anatomy
Rust types
CheckboxGroup
Checkbox Group is assembled from these builders. The API reference lists each one.
Customization
Appearance builders and theme tokens Checkbox Group uses.
Styling
| Style | Description |
|---|---|
text_size + line_height | Option labels use 14px/20px medium text; descriptions use 12px/16px regular text. |
CheckboxGroup::render flex_col + gap(px(16.)) | Group root stacks label, options and help/error text. |
option list gap(px(16.)) | Sixteen-pixel spacing between option rows. |
label_el flex_col + gap(px(4.)) | Per-option label/help stack. |
Checkbox row | Option control and text row. |
API reference
Builders
| Builder | Type | Default | Description |
|---|---|---|---|
value( | string[] | — | Current selected values (controlled). |
default_value( | string[] | — | Initial selected values (uncontrolled). |
on_change( | Fn( | — | Handler called with the complete selected set. |
is_disabled( | bool | false | Disables every option and omits the group from form submission. |
is_required( | bool | false | Requires at least one enabled option to be selected. |
is_read_only( | bool | false | Keeps enabled options focusable while preventing changes. |
is_invalid( | bool | false | Marks the group and every option invalid. |
name( | string | — | Submitted form field name for the selected values. |
new( | id, | — | Compound group content; takes options plus label/description/error builders. |
Parts
| Part | Description |
|---|---|
CheckboxGroup | Group value, validation, form and option composition owner. |
CheckboxGroup | Group label with required, disabled and invalid state. |
CheckboxGroup | Optional group or per-option help text. |
CheckboxGroup | One generated checkbox per option. |
CheckboxGroup | Option label and optional description content. |
CheckboxGroup | Selection control inherited from Checkbox. |
CheckboxGroup | Selection mark inherited from Checkbox. |
CheckboxGroup | Group validation message rendered in place of the description. |
States
| Builder | State | Description |
|---|---|---|
CheckboxGroup::is_disabled | Disabled | Every option is disabled and omitted from the successful form value. |
CheckboxGroup::is_read_only -> Checkbox::is_read_only | Read only | Options remain focusable but cannot toggle. |
is_invalid + error_message | Invalid | Danger treatment propagates to each option and the field error. |
FormField::is_required | Required | Native form validation requires one enabled selected value. |
util::controlled(Some(value)) | Controlled | The caller owns the selected set; callbacks report without mutating behind it. |
util::controlled(None) + restore | Uncontrolled | The group owns and resets its keyed selected set. |