GCBGutenberg
Control Blocks
Buy

Field type

spacing

Preset spacing scale (None / S / M / L) with a custom-value escape hatch. Stores either a preset key or a CSS length string.

Type: spacing · Stored attribute type: string

Stored value

string — one of "none" | "small" | "medium" | "large", OR a CSS length like "2rem" when the custom escape hatch is used.

Supports

  • Toggle-group of presets (defaults: None / S / M / L)
  • Custom CSS-length input with validation
  • Configurable preset list

Config options

OptionTypeDefaultDescription
presets{ value, label }[][{ value: "none", label: "None" }, { value: "small", label: "S" }, { value: "medium", label: "M" }, { value: "large", label: "L" }]Override the preset toggle group.

Gotchas

  • Stored value is EITHER a preset key ("medium") OR a CSS length ("2rem"). The renderer must map preset keys to your spacing scale before applying.
  • Custom values must match ^(\d*\.?\d+)(px|rem|em|%|vw|vh|vmin|vmax)?$ — invalid input is rejected with an inline warning.

Example

JSON
{ "id": "ctrl_gap",
  "type": "spacing",
  "label": "Section gap",
  "attributeKey": "gap",
  "default": "medium",
  "parentPanelId": "panel" }

Every field also takes the keys common to all fields.

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

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