Free cookie consent management tool by TermsFeed Generator
All Products & Integrations

jalpi page builder docs

Style Controls

Choosing and configuring the right control for a schema-widget field.

Jalpi CoreDeveloper
3 min read Β· November 2026

A schema widget’s entire UI comes from its fields array. This guide covers picking controls, grouping them, conditional visibility, and the two repeater shapes.

Choosing a control#

NeedControlStored value
Short texttextstring
Long text or a newline-separated listtextareastring
A numbernumbernumeric string
A bounded number the user should feelslidernumeric string
On / offtoggleboolean
One of severalselectoption key
One of a few, shown as pillsbuttongroupoption key β€” identical storage to select
A colourcolorcolour string
A linkurlURL string
An image from the media libraryimageattachment URL
Any iconiconIconValue object
Several from a visual gridmultiiconcomma-separated keys
Four-sided spacing or radiusdimensions4CSS shorthand string
An ordered list of known optionsrepeatercomma-separated keys (+ optional colour map)
An ordered list of objectsitemsRepeaterJSON string

Notice that every control stores a string (or a boolean, or one object for icon). That is deliberate: PHP never has to learn a new data type when a richer control is added.

Grouping and tabs#

{ key: 'iconSize', label: 'Size', control: 'slider',
  min: 6, max: 120, step: 1, unit: 'px', placeholder: '18',
  group: 'Icon', tab: 'style' }
  • group puts the field inside a named PropGroup accordion. Fields sharing a group name are collected together in declaration order.
  • tab: 'style' moves the field out of the Content tab and into GenericStyleExtras at the top of the Style tab. Default is 'content'.

Use this to keep the Content tab about what the widget says and the Style tab about how it looks β€” the same split users already expect from the bespoke widgets.

Conditional visibility#

{ key: 'iconColorMode', label: 'Color', control: 'select',
  options: [{ value: 'official', label: 'Official Color' }, { value: 'custom', label: 'Custom' }] },
{ key: 'iconColor', label: 'Custom Color', control: 'color',
  showIf: { key: 'iconColorMode', equals: 'custom' } },

showIf takes { key, equals? | notEquals? | truthy? }. It only hides the control β€” the value stays in content if it was set before, so toggling back restores it.

The two repeaters#

repeater β€” an ordered list of known option keys, stored as a comma string. An optional colorKey names a companion content key holding a key:color,key:color map, so per-item colours can be added without changing the primary field’s shape. Absent entries fall back to the option’s own colour, which is why existing content keeps rendering identically.

itemsRepeater β€” an ordered list of objects, each with its own sub-fields. Stored as a JSON string in the field’s key, so the sanitizer’s default text path leaves it intact and a dedicated renderer decodes it.

{
  key: 'items', label: 'Social Icons', control: 'itemsRepeater',
  addLabel: 'Add Item', itemTitleKey: 'link', addWithIconPicker: true,
  itemFields: [
    { key: 'icon',  label: 'Icon',  control: 'icon' },
    { key: 'link',  label: 'Link',  control: 'url', placeholder: 'Type or paste your URL' },
    { key: 'color', label: 'Color', control: 'color' },
  ],
}

addWithIconPicker: true makes β€œ+ Add Item” open the icon library first and store the result in the new item’s icon sub-field. It requires an icon sub-field to exist.

The PHP side of a control#

Each control type maps to an escaper in sanitize_generic_content(). The field-type strings you write in widgets-schema.php are what select it:

Schema field typeEscaping
textsanitize_text_field()
textareasanitize_textarea_field()
numberNumeric coercion
toggleBoolean cast
selectText field β€” the renderer re-validates against its own allow-list
colorJalpi_Sanitizer::sanitize_color()
urlJalpi_Sanitizer::sanitize_url()
iconJalpi_Sanitizer::sanitize_icon_value()
social-itemsJSON list of {icon, link, color}, each member validated

Because select is stored as free text and re-validated at render time, the render branch must always call enum() (or an equivalent) rather than trusting the stored value directly.

Source

Files

admin/editor/src/widgets/registry.ts includes/widgets-schema.php includes/class-jalpi-sanitizer.php admin/editor/src/widgets/GenericContent.tsx includes/elements/class-jalpi-element-generic.php

Classes

Jalpi_Sanitizer Jalpi_Element_Generic

Functions

sanitize_generic_content render_template enum