Block controls
Reference for all 11 block control types and how to use their values in TWIG templates
Block controls are custom inputs that appear in the block inspector sidebar when an editor selects the block in Gutenberg. Each control's current value is passed to the TWIG callback as a variable.
Naming rule: Control names are lowercased and spaces/dashes are converted to underscores. A control named Badge Label → {{ badge_label }} in TWIG.
Control types overview
Text
A single-line text input. Use it for short custom strings like labels, titles, or CTA text.
TWIG type: string
Example — customisable CTA button:
Textarea
A multi-line text area. Use it for longer custom content like descriptions or notes.
TWIG type: string
Textarea values are plain text. Use
|nl2br|rawto respect line breaks.
Example:
Settings available:
rows
Number of visible rows in the editor sidebar
Number
A numeric input. The value arrives in TWIG as an integer.
TWIG type: integer
Example — control number of gallery columns:
Settings available:
min
Minimum allowed value
max
Maximum allowed value
step
Increment step
Range
A slider control. Identical to Number but rendered as a slider in the editor sidebar.
TWIG type: integer
Example — opacity control:
Settings available: same as Number (min, max, step).
A text input validated as an email address.
TWIG type: string
Example:
Phone
A text input validated as a phone number (type="tel").
TWIG type: string
Example:
Checkbox
A checkbox that returns true when checked, false (or null) when unchecked.
TWIG type: boolean
Example:
Toggle
A toggle switch — functionally identical to Checkbox but rendered as a visual on/off switch in the editor sidebar. Prefer Toggle when the meaning is clearly binary (show/hide, enabled/disabled).
TWIG type: boolean
Example:
Radio
A set of radio buttons. Only one option can be selected at a time. The value in TWIG is the value of the selected option (not the label).
TWIG type: string
Example — layout switcher:
Define options in the wizard: { value: 'grid', label: 'Grid' }, { value: 'list', label: 'List' }.
Select
A dropdown that lets the editor pick one option. The value in TWIG is the value of the selected option.
TWIG type: string
Example — theme colour:
Define options: { value: 'blue', label: 'Blue' }, { value: 'green', label: 'Green' }, { value: 'red', label: 'Red' }.
SelectMulti
A multi-select dropdown. The editor can pick several options. The value in TWIG is an array of the selected option values.
TWIG type: array
Example — display selected tags:
Example — apply multiple CSS classes:
Last updated