GCBGutenberg
Control Blocks
Buy

Field type

text & textarea

The simplest controls. Single-line input (text) or multi-line (textarea). Both store a single string.

Type: text, textarea (alias listed in the doc) · Stored attribute type: string

Stored value

string

Supports

  • Plain string values, no formatting
  • Validation rules (required, minLength, maxLength, pattern)
  • Placeholder text and inline help

Config options

OptionTypeDefaultDescription
defaultstringInitial value if the author hasn't edited the field.
placeholderstringGreyed-out hint shown when the input is empty.
helpTextstringOne-line description shown below the input.
validation.requiredbooleanBlock save until the field is filled in.
validation.minLengthnumberMinimum character count.
validation.maxLengthnumberMaximum character count. Shown as "X / Y" counter in the editor.
validation.patternstring (regex)Regex the value must match. Enforced client- and server-side.

Example

JSON
{ "id": "ctrl_eyebrow",
  "type": "text",
  "label": "Eyebrow",
  "attributeKey": "eyebrow",
  "default": "",
  "placeholder": "e.g. New in beta",
  "validation": { "maxLength": 60 },
  "parentPanelId": "panel" }

Consume

JSX

JSX
export default function MyBlock({ attributes }) {
  const { eyebrow = '' } = attributes;
  return eyebrow ? <span className="eyebrow">{eyebrow}</span> : null;
}

PHP

PHP
<?php
$eyebrow = $attributes['eyebrow'] ?? '';
if ($eyebrow): ?>
  <span class="eyebrow"><?php echo esc_html($eyebrow); ?></span>
<?php endif; ?>

Every field also takes the keys common to all fields.

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

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