GCBGutenberg
Control Blocks
Buy

Field type

number

Numeric input with up/down spinners. Stores a number (not a string), with optional min, max, step and decimals (the precision it prints with).

Type: number · Stored attribute type: number

Stored value

number

Supports

  • Min / max bounds and step increments
  • Coerces empty input to 0 so consumers always see a number

Config options

OptionTypeDefaultDescription
minnumberMinimum allowed value.
maxnumberMaximum allowed value.
stepnumber1Increment for the spinner / arrow keys.
decimalsintegerThe precision the field prints with, as a count of decimals read off the sample in the design ("5.0" is 1, "4.95" is 2, "14,395" is 0). The render passes it to gcblite_number(); without it a value prints with the decimals it was stored with, and a default stored as a number prints "5", not "5.0".
placeholderstringGreyed-out hint shown when the input is empty.

Gotchas

  • Empty input becomes 0, not null or empty string. If you need "unset" semantics, pair with a boolean toggle.
  • Min/max are advisory — bound-checks happen via the underlying control but not enforced server-side. Validate again on save if it matters.

Example

JSON
{ "id": "ctrl_columns",
  "type": "number",
  "label": "Columns",
  "attributeKey": "columns",
  "default": 3,
  "min": 1,
  "max": 6,
  "parentPanelId": "panel" }
{ "id": "ctrl_rating",
  "type": "number",
  "label": "Rating",
  "attributeKey": "rating",
  "default": 5.0,
  "decimals": 1,
  "step": 0.1 }

Every field also takes the keys common to all fields.

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

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