GCBGutenberg
Control Blocks
Buy

Field type

size

CSS length input with a unit dropdown (px, em, rem, %, vh, vw). Stores a single CSS-ready string you can drop straight into style.

Type: size · Stored attribute type: string

Stored value

string — a CSS length like "16px", "1.5rem", "100%". Empty string when unset.

Supports

  • Numeric input + unit selector via WP's UnitControl
  • Supported units: px, em, rem, %, vh, vw
  • Plain-text fallback when UnitControl isn't available

Config options

OptionTypeDefaultDescription
helpTextstringOne-line description shown below the input.

Gotchas

  • Stored value is a CSS string, not a number — pass it directly to style.width / style.padding in React, or echo it inside a style attribute in PHP.
  • For spacing-scale presets (None / S / M / L) use spacing instead — size is for free-form CSS lengths.

Example

JSON
{ "id": "ctrl_width",
  "type": "size",
  "label": "Container width",
  "attributeKey": "container_width",
  "default": "960px",
  "parentPanelId": "panel" }

Every field also takes the keys common to all fields.

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

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