checkbox-group
Multi-select control. Alias `button-group` renders the same control with different visual styling. Use when authors need to pick zero or more options from a fixed list.
Stored value
array of strings — the selected option `value`s
Supports
- Multi-select from a fixed list of options
- Two visual styles via the alias `button-group` (same stored shape)
- Default selection via `default` array
Config options
options{ value, label }[]- The choices. Required.
defaultstring[]- Pre-selected values. Empty array if omitted.
Example
json
{ "id": "ctrl_categories",
"type": "checkbox-group",
"label": "Show categories",
"attributeKey": "categories",
"default": ["design"],
"options": [
{ "value": "design", "label": "Design" },
{ "value": "engineering", "label": "Engineering" },
{ "value": "product", "label": "Product" }
],
"parentPanelId": "panel" }
Gotchas
Heads up
For single-select use `toggle-group`. The controls are picked by the SHAPE of the saved value: array of strings (multi) vs single string (single).
Notes
Consume
export default function Filters({ attributes }) {
const cats = Array.isArray(attributes.categories) ? attributes.categories : [];
return (
<ul>
{cats.map((c) => <li key={c}>{c}</li>)}
</ul>
);
}