GCBGutenberg
Control Blocks
Buy

Field type

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.

Type: checkbox, checkbox-group (alias listed in the doc) · Stored attribute type: boolean

Stored value

array of strings — the selected option values

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

OptionTypeDefaultDescription
options{ value, label }[]The choices. Required.
defaultstring[]Pre-selected values. Empty array if omitted.

Gotchas

  • 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).

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" }

Consume

JSX

JSX
export default function Filters({ attributes }) {
  const cats = Array.isArray(attributes.categories) ? attributes.categories : [];
  return (
    <ul>
      {cats.map((c) => <li key={c}>{c}</li>)}
    </ul>
  );
}

PHP

PHP
<?php
$cats = is_array($attributes['categories'] ?? null) ? $attributes['categories'] : [];
?>
<ul>
  <?php foreach ($cats as $c): ?>
    <li><?php echo esc_html($c); ?></li>
  <?php endforeach; ?>
</ul>

Every field also takes the keys common to all fields.

Built from GCB Lite 0.4.0 (ce232d4). Source: schemas/controls/checkbox.md.

Copyright © 2026 Runchain. WordPress is a trademark of the WordPress Foundation.