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
UnitControlisn't available
Config options
| Option | Type | Default | Description |
|---|---|---|---|
helpText | string | One-line description shown below the input. |
Gotchas
- Stored value is a CSS string, not a number — pass it directly to
style.width/style.paddingin React, or echo it inside astyleattribute in PHP. - For spacing-scale presets (None / S / M / L) use
spacinginstead —sizeis for free-form CSS lengths.
Example
{ "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.