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

jalpi page builder docs

Editor Controls

The control primitives behind Jalpi's inspector: property groups and rows, slider and dimension inputs, spacing grids, color and typography controls, Design System token linking, repeaters and pickers.

Jalpi CoreDeveloper
17 min read Β· November 2026

Every field in the Jalpi inspector is built from a small set of reusable control components defined at the bottom of PropertiesPanel.tsx. Roughly a hundred widget-specific panels sit above them, but they all compose the same two dozen primitives β€” which is why a slider behaves identically whether it is setting an icon size or a border radius.

This page catalogues those primitives: what each one is called, what shape of value it reads and writes, and the conventions they share. It also covers the two mechanisms that cut across all of them β€” how a control decides whether it is writing a desktop value or a breakpoint override, and how any control can be linked to a Design System token.

If you are adding a panel for a new widget, this is the vocabulary to build it from.

Anatomy of a Panel#

Three components provide the structure every inspector panel is assembled from.

The properties inspector with grouped controls, a device switcher, text, select, slider, colour and spacing controls
Figure: Inspector controls panel displaying grouped settings accordions and responsive device write controls.

PropGroup and AccordionScope#

PropGroup is a collapsible titled section with an optional icon and badge. AccordionScope wraps a set of them in a React context so that opening one closes the others.

<AccordionScope defaultGroup="Background">
  <PropGroup label="Background" icon={<BgIcon />}> … </PropGroup>
  <PropGroup label="Border">                      … </PropGroup>
</AccordionScope>

The accordion keys purely off the label string, which has one important consequence: two groups sharing a label inside the same scope open and close together. PropGroup therefore accepts standalone, which opts out of the enclosing scope in favour of independent local state. The interaction rule editor uses it, since each rule renders its own "Settings" group.

PropertiesPanel opens a fresh AccordionScope per tab, keyed by node id, with a per-type default group resolved from the CONTENT_FIRST_GROUP and STYLE_FIRST_GROUP lookups β€” so selecting a heading opens a different group than selecting an image.

InheritedBadge is the optional badge: a small "from .card" pill shown on a group title when none of its properties are set locally but an attached class supplies one. Its tooltip explains the override rule directly.

PropRow#

The label-plus-control row that most fields use:

function PropRow({ label, children, stack, responsive })
  • stack puts the control below the label instead of beside it β€” used for wide controls like textareas and the class picker.
  • responsive adds a small device glyph to the label, marking the property as one that stores per-breakpoint values.

That glyph is a convention rather than a mechanism: it tells the user the field is breakpoint-aware, while the actual routing is handled by the panel's update() function.

How a Control Writes a Value#

Controls never touch the store directly. Each panel builds one update() function and passes it down, and that function encapsulates the breakpoint rule:

const bp      = state.breakpoint;
const respKey: 'tabletStyles' | 'mobileStyles' | null =
  bp === 'tablet' ? 'tabletStyles' : bp === 'mobile' ? 'mobileStyles' : null;
const respStyles = respKey ? (node[respKey] ?? {}) : {};

// Effective styles: desktop base + non-empty responsive overrides on top
const styles = respKey
  ? { ...(node.styles ?? {}), ...Object.fromEntries(
        Object.entries(respStyles).filter(([, v]) => v != null && v !== '')) }
  : (node.styles ?? {});

const update = (updates: Record<string, string>) => {
  if (respKey) store.updateNode(node.id, { [respKey]: { ...respStyles, ...updates } });
  else         store.updateNodeStyles(node.id, updates);
};

Two behaviours fall out of this, and both match what the frontend does:

  • Reading is a merge. On tablet or mobile the panel displays the desktop value until an override exists, so a field is never blank just because you switched device.
  • Writing is an override. Editing on tablet writes into tabletStyles only; the desktop value is untouched. This is what the "Editing Tablet β€” overrides only" banner is telling you.

Empty-string values are filtered out of the merge, so clearing a field on tablet falls back to the desktop value rather than resolving to nothing.

Some panels keep a second updateResp() alongside update() for properties that are always per-breakpoint β€” section and container width and height, for instance, which store their values per device with a desktop fallback.

The Primitive Catalogue#

ComponentValue shapeUsed for
TextInputstringPlain text fields
SelectstringDropdowns from {value,label}[]
TogglebooleanOn/off switches
AlignButtonsstringLeft / center / right / justify segmented control
SliderPropRowstring with unitAny numeric CSS value
DimensionInputstring with unitWidth, height, auto
SliderDimInputstring with unitSlider variant used in layout panels
BoxSpacingControlfour stringsMargin, padding, radius β€” the 2Γ—2 grid
ColorPropRowstringLabel + optional token globe + swatch
ColorInputstringSwatch plus editable hex field
TokenLinkControllink refLinks one style property to a Design System token
TypographyTriggerRow + TypographyPopupstyle bagThe full typography editor
FontFamilySearchstringSearchable, category-grouped font picker
NormalHoverTabs'normal' | 'hover'State switch for two-state style groups
ItemRepeaterT[]Repeatable item lists
MediaPickerInput / ImageUploadInputstringWordPress media library fields
StarRatingInputnumberStar rating
PopupSliderField, ShadowSliderstringSliders inside popups
ClassPickerstring[]Attach and detach reusable classes

The convention across all of them is that a control receives value and onChange and knows nothing about nodes or the store β€” with the deliberate exception of the linking controls, which need the node to store the link.

Numeric and Dimension Controls#

Three controls handle numbers with units, each solving a slightly different problem.

SliderPropRow#

The workhorse: a labelled header with a unit dropdown, then a range slider and a number field bound to the same value.

<SliderPropRow
  label="Size"
  responsive
  value={styles.iconSize || ''}
  onChange={(v) => update({ iconSize: v })}
  min={8} max={300} step={1}
  units={['px', 'em']}
  placeholder="48"
/>

It parses the unit back out of the stored string, checking rem, em, px, %, vw and vh in that order and falling back to the first entry of units. Two details matter in use:

  • The slider range adapts to the unit. When the active unit is %, vw or vh the maximum is forced to 100 regardless of the max prop, so a percentage slider always spans the full range.
  • Empty is preserved. Clearing the number field emits '' rather than 0, which is what lets a tablet override fall back to the desktop value.

Unit switching keeps the number and re-appends the new unit, defaulting to 0 when there is no number yet.

Passing the optional link prop turns the header into a token-linking control.

DimensionInput#

A compact text field with a unit button that cycles rather than a dropdown, used where space is tight. It supports auto as a first-class value and recognises dvh, vw, vh, rem, em, px and %.

Its subtlety is the pending unit: when the field is empty there is no unit embedded in the value, so the chosen unit is held in local state. Cycling units on an empty field updates the badge and waits for a number; cycling with a number present re-emits immediately.

It also accepts raw CSS β€” anything the user types ending in a letter or % is passed straight through, so calc()-free expressions and unusual units are not blocked.

BoxSpacingControl#

The four-sided grid used for margin, padding and radius. It takes {top, right, bottom, left} and an onChange(side, value), plus an optional onChangeAll(value).

Its link toggle starts on when every non-empty side already shares a value, so an evenly spaced element opens in linked mode automatically. While linked, editing any field writes all four β€” through onChangeAll in a single call when supplied, otherwise via four onChange calls.

Each field supports keyboard nudging: ArrowUp and ArrowDown step by 1, or by 10 with Shift held, preserving the existing unit and defaulting to px. Values are clamped at 0.

Color Controls#

ColorPropRow is the standard row: a label, a globe button, and a swatch that opens the native color picker. The swatch is an <input type="color"> overlaid at zero opacity, so the browser's own picker is used while the visible chip keeps the panel's styling.

ColorInput is the fuller variant β€” swatch plus an editable text field β€” used where a non-hex value such as rgba() or currentColor needs to be typed.

The globe on ColorPropRow only does something when the link prop is passed. Without it, the button renders as an inert placeholder with tabIndex={-1}.

Design System Token Linking#

TokenLinkControl is how any style property becomes a reference to a site-wide token rather than a literal. It renders a globe that opens a dropdown of tokens from the matching category, writing through store.linkNodeToken() and store.unlinkNodeToken() into the node's globalStyleRef.tokens map.

Which category a property can link to is decided by one shared table in utils/designTokens.ts, so every control opts in the same way instead of each call site hardcoding a category:

CategoryProperties
colorscolor, colorHover, backgroundColor, backgroundColorHover, borderColor, borderColorHover, linkColor, linkColorHover, gradientColor1, gradientColor1Hover, gradientColor2, gradientColor2Hover
fontFamiliesfontFamily
fontSizesfontSize
lineHeightslineHeight
letterSpacingletterSpacing
borderRadiusborderRadius
boxShadowsboxShadow
spacingmarginTop/Right/Bottom/Left, paddingTop/Right/Bottom/Left, gap, rowGap, columnGap
opacityopacity

tokenCategoryFor(styleProp) returns the category or undefined, and a control with no linkable category simply does not render the linker.

The precedence rule is important and is documented in the source: a literal value written through the control's own onChange always takes visual precedence over the link, both in the canvas preview and on the frontend. The link stays stored but has no effect until the literal is cleared. This mirrors how typography and button preset links behave in PresetLinker.

The ten token categories, their labels and the CSS variable names they compile to all live in utils/designTokens.ts, whose VAR_PREFIX map carries a comment requiring it to match Jalpi_Settings::TOKEN_VAR_PREFIX exactly.

Typography Controls#

Typography is a popup rather than an inline group, because it edits nine properties at once.

TypographyTriggerRow renders the label with a pencil button; clicking it opens TypographyPopup through createPortal, positioned to the left of the inspector and clamped to stay on screen. It closes on outside mousedown, ignoring clicks on its own trigger.

The popup edits fontFamily, fontSize, fontWeight, textTransform, fontStyle, textDecoration, lineHeight, letterSpacing and wordSpacing, and its Reset all button clears exactly that set. It receives the panel's respKey so it can show the responsive glyph when editing a breakpoint override.

FontFamilySearch is the family picker: a search field over jalpiEditorConfig.fonts, grouped by category (Sans Serif, Serif, Display, Handwriting, Monospace).

Fonts preview live in the editor because loadGoogleFont() injects a <link> into the document head on demand, deduplicated through a module-level Set:

const _loadedGFonts = new Set<string>();

function loadGoogleFont(family: string) {
  if (!family || _loadedGFonts.has(family)) return;
  _loadedGFonts.add(family);
  const link = document.createElement('link');
  link.rel  = 'stylesheet';
  link.href = `https://fonts.googleapis.com/css2?family=${encodeURIComponent(family)}:wght@400;500;600;700&display=swap`;
  document.head.appendChild(link);
}

TextShadowPopup follows the same trigger-plus-portal pattern, built from ShadowSlider fields.

Normal and Hover States#

NormalHoverTabs is a two-value switch held in the panel's local state. Groups that support a hover state read and write different property names depending on it, rather than maintaining two parallel control sets:

<NormalHoverTabs state={nh} onChange={setNh} />

<ColorPropRow
  label="Primary Color"
  value={nh === 'normal' ? (styles.color || '') : (styles.iconColorHover || '')}
  onChange={(v) => update(nh === 'normal' ? { color: v } : { iconColorHover: v })}
  placeholder="currentColor"
/>

The convention throughout the panel is a Hover suffix on the property name β€” colorHover, backgroundColorHover, borderColorHover, iconColorHover. Backgrounds and borders that carry a whole settings bucket use bgNormal / bgHover and borderNormal / borderHover instead.

Repeaters#

ItemRepeater<T> is the generic list editor behind every widget with repeatable content β€” accordion items, icon lists, pricing features, table rows, tabs, testimonials, timelines.

It is a controlled component over an array: it renders each item with a number badge and a remove button, exposes update(idx, key, value) to its children, and appends a copy of a newItem template on add. All operations produce a new array rather than mutating, keeping the store's immutability contract intact.

Because it is generic over T extends Record<string, unknown>, each widget supplies its own item shape and its own per-field controls.

Media, Icon and Tag Pickers#

Three pickers reach outside the panel for their values.

Media#

MediaPickerInput and ImageUploadInput open the WordPress media library. This works because Jalpi_Editor::enqueue_editor() calls wp_enqueue_media() before the bundle loads, making wp.media() available to the editor.

Icons#

IconPickerModal covers five libraries β€” built-in SVGs, Font Awesome, Bootstrap Icons, Material Symbols and Tabler Icons β€” with search and per-browser favourites. Its catalogue comes from utils/iconRegistry.ts.

A picked icon is stored as an IconValue object rather than a bare string. RenderIconValue is the counterpart used on the canvas, and it handles three cases: a legacy plain-string key resolved against the built-in registry, an IconValue with its SVG cached at pick time, and an IconValue seeded as a default with no cached SVG, which is resolved from the built-in registry by name.

Font-based libraries render as <i class="…">, except Material Symbols which renders the icon name as element text.

Dynamic Tags#

DynamicTagPicker is the popover that inserts a {{tag}} into any text or URL field. It fetches its grouped tag list from the /dynamic-tags route the first time it opens, caching the result for the session, and offers search across label, tag and parameter.

Selecting a tag composes the final string, appending a fallback when one has been typed:

const buildTagString = (t: TagDef): string => {
  const base = t.param ? `${t.tag}:${t.param}` : t.tag;
  return fallback ? `{{${base}|${fallback}}}` : `{{${base}}}`;
};

That grammar β€” {{tag:param|fallback}} β€” is exactly what Jalpi_Dynamic_Tags::resolve() parses on the server.

Animation Controls#

The Animation tab is built from AnimationPresetPicker and InteractionRuleEditor.

AnimationPresetPicker is a searchable, category-tabbed picker over the named library in utils/animationPresets.ts. Each swatch previews itself on hover using the Web Animations API β€” and the file's header comment is explicit that this is editor-only: production playback is always the CSS @keyframes engine in assets/css/frontend.css. The preview never ships in the frontend bundle.

InteractionRuleEditor edits one rule of a node's interactions array, with move-up and move-down controls for ordering. Each rule renders its own PropGroup labelled "Settings", which is precisely the case standalone exists for. restartRuleOnCanvas() replays a rule on the canvas so a change can be seen without leaving the panel.

The Advanced Tab#

Three groups on the Advanced tab deal with CSS rather than styles.

CssIdentityGroup holds the class picker, a CSS ID field (settings.cssId) and a Custom CSS Class field (settings.cssClass). Both are applied by CanvasNode to the wrapper, so a hand-written class previews live in the editor.

ClassPicker manages reusable classes as chips. Typing filters existing classes and offers to create one; Enter attaches an exact match or creates a new class. Clicking a chip's name calls store.setEditingClassKey(), which opens ClassStyleEditorModal and β€” while it is open β€” redirects the Style and Advanced tabs to edit that class instead of the node. Detaching is the Γ— on the chip.

The class editor is built from the same primitives as the per-element tabs (TypographyPopup, SectionBgEditor, BoxSpacingControl), which is what guarantees a class compiles to the same CSS as node styles β€” Jalpi_Renderer::compile_class_css() reuses the same styles_to_css / bg_data_to_css / border_data_to_css helpers. Edits go into the shared store immediately so every attached element updates live, then persist to the server debounced.

CustomCssGroup is a plain textarea storing settings.customCss. Its one convention is the selector token:

selector {
  /* your CSS */
}
selector:hover {
  color: blue;
}

selector is replaced server-side with the node's own scoped selector by Jalpi_Renderer::maybe_add_custom_css().

Per-Widget Style Tabs#

StyleTab is a dispatcher before it is a panel. It begins with a run of early returns handing off to a dedicated style tab for widgets with substantial styling needs:

SectionStyleTab (shared by section, container and column), TestimonialsStyleTab, VideoStyleTab, ProgressStyleTab, CounterStyleTab, AccordionStyleTab, IconListStyleTab, FeatureCardStyleTab, FaqStyleTab, ImageCarouselStyleTab, ImageStyleTab, CTAStyleTab, GalleryStyleTab, ProductsGridStyleTab, ProductCategoriesStyleTab, SingleProductStyleTab, TabsAdvStyleTab, MenuStyleTab, AdvMenuStyleTab and BreadcrumbsStyleTab.

Everything that falls through gets the generic style panel β€” alignment, typography, text shadow, paragraph spacing, colors with normal/hover states, and the shared background, border and spacing groups.

Schema-driven widgets get one extra step: StyleTab renders GenericStyleExtras for any type where isSchemaWidget(node.type) is true, so a registry-defined widget can contribute style controls without a bespoke panel.

The content side mirrors this with one *Content component per widget type, dispatched by ContentTab.

Examples#

The breakpoint-aware update function#

Every panel builds one of these. Reading merges desktop with non-empty overrides; writing targets only the active breakpoint's map.

const bp = state.breakpoint;
const respKey: 'tabletStyles' | 'mobileStyles' | null =
  bp === 'tablet' ? 'tabletStyles' : bp === 'mobile' ? 'mobileStyles' : null;

const respStyles: StyleMap = respKey ? (node[respKey] ?? {}) : {};

// Effective styles: desktop base + non-empty responsive overrides on top
const styles: StyleMap = respKey
  ? { ...(node.styles ?? {}), ...Object.fromEntries(
      Object.entries(respStyles).filter(([, v]) => v != null && v !== '')) }
  : (node.styles ?? {});

const update = (updates: Record<string, string>) => {
  if (respKey) store.updateNode(node.id, { [respKey]: { ...respStyles, ...updates } });
  else         store.updateNodeStyles(node.id, updates);
};

A typical control row#

SliderPropRow reads and writes a single unit-bearing string. responsive marks the label; the actual routing is in update().

<SliderPropRow
  label="Size"
  responsive
  value={styles.iconSize || ''}
  onChange={(v) => update({ iconSize: v })}
  min={8} max={300} step={1}
  units={['px', 'em']}
  placeholder="48"
/>

{/* With Design System token linking enabled */}
<SliderPropRow
  label="Font Size"
  value={styles.fontSize || ''}
  onChange={(v) => update({ fontSize: v })}
  units={['px', 'rem', 'em']}
  link={{ store, node, styleProp: 'fontSize' }}
/>

One shared table decides which category a property links to. A property absent from it renders no linker at all.

export const LINKABLE_PROPS: Record<string, TokenCategory> = {
  color:            'colors',
  backgroundColor:  'colors',
  borderColor:      'colors',
  fontFamily:       'fontFamilies',
  fontSize:         'fontSizes',
  lineHeight:       'lineHeights',
  letterSpacing:    'letterSpacing',
  borderRadius:     'borderRadius',
  boxShadow:        'boxShadows',
  paddingTop:       'spacing',
  gap:              'spacing',
  opacity:          'opacity',
  // … see utils/designTokens.ts for the full table
};

export function tokenCategoryFor(styleProp: string): TokenCategory | undefined {
  return LINKABLE_PROPS[styleProp];
}

Keyboard nudging in the spacing grid#

Arrow keys step the value by 1, or 10 with Shift, preserving whatever unit is already there.

const handleKeyDown = (side: string) => (e: React.KeyboardEvent<HTMLInputElement>) => {
  if (e.key !== 'ArrowUp' && e.key !== 'ArrowDown') return;
  e.preventDefault();
  const step = e.shiftKey ? 10 : 1;
  const dir  = e.key === 'ArrowUp' ? 1 : -1;
  const match = e.currentTarget.value.match(/^(-?[\d.]+)(.*)$/);
  if (match) {
    const num  = parseFloat(match[1]);
    const unit = match[2] || 'px';
    handle(side, `${Math.max(0, num + dir * step)}${unit}`);
  } else {
    handle(side, `${Math.max(0, dir * step)}px`);
  }
};

One control, two states#

NormalHoverTabs holds the state; each control picks its property name from it rather than duplicating the control.

const [nh, setNh] = useState<NHState>('normal');

<NormalHoverTabs state={nh} onChange={setNh} />

<ColorPropRow
  label="Primary Color"
  value={nh === 'normal' ? (styles.color || '') : (styles.iconColorHover || '')}
  onChange={(v) => update(nh === 'normal' ? { color: v } : { iconColorHover: v })}
  placeholder="currentColor"
/>

Per-node Custom CSS#

Stored in settings.customCss. The selector token is replaced with the node's own scoped selector by Jalpi_Renderer::maybe_add_custom_css().

selector {
  border-left: 4px solid var(--jalpi-color-primary);
  transition: transform .2s ease;
}

selector:hover {
  transform: translateY(-2px);
}

selector .jalpi-heading {
  letter-spacing: .04em;
}

Notes#

  • The accordion in AccordionScope keys off the group's label string, not its identity. Two PropGroups with the same label in one scope open and close together β€” pass standalone to opt a group out into independent local state.
  • Controls are deliberately store-agnostic: they take value and onChange and nothing else. The exceptions are TokenLinkControl and ClassPicker, which need the node because they write links rather than values.
  • SliderPropRow forces the slider's maximum to 100 when the active unit is %, vw or vh, regardless of the max prop.
  • Clearing a numeric field emits an empty string rather than 0. That is what allows a breakpoint override to be removed so the desktop value shows through again.
  • DimensionInput passes through anything the user types that ends in a letter or %, so unusual units and raw CSS values are not blocked by the unit cycler.
  • Google Fonts are injected into the editor document on demand by loadGoogleFont() and deduplicated through a module-level Set. The frontend enqueues fonts separately, based on what the renderer actually saw during its pass.
  • Icon values are stored as IconValue objects with the SVG cached at pick time. RenderIconValue still handles legacy plain-string keys and seeded defaults with no cached SVG by resolving them from the built-in registry by name.
  • The animation preset picker's hover preview uses the Web Animations API and exists only in the editor. Production playback is always the CSS @keyframes engine in assets/css/frontend.css.

Warnings#

  • DynamicTagPicker builds its request as ${jalpiEditorConfig.apiUrl}/jalpi-page-builder/v1/dynamic-tags, but apiUrl is already rest_url('jalpi-page-builder/v1') β€” the namespace appears twice in the resulting URL. The failure is silent: the .catch() only clears the loading flag, so the picker renders an empty tag list rather than an error. Every other call goes through useApi, which appends only the route path.
  • The globe button on ColorPropRow is inert unless the link prop is supplied β€” it renders as a non-focusable placeholder. The globe on TypographyTriggerRow is a placeholder in every case; its comment marks it as reserved for future global-style linkage.
  • A literal value always beats a token link. Setting a color through the swatch does not clear an existing link β€” the link remains stored and silently inactive until the literal is cleared, which can look like the link is broken.
  • Editing at tablet or mobile writes into tabletStyles / mobileStyles only. The panel shows the inherited desktop value, so a field that looks populated may have no override of its own β€” and clearing it returns to the desktop value rather than to nothing.
  • ClassPicker swallows failures from createClass(). The source notes that server-side name collisions are auto-suffixed, so a failure here means a network or permission problem β€” but the user sees only that no chip appeared.
  • Custom CSS is not validated. Whatever is typed is stored on the node and compiled with the selector token substituted at render time; a malformed rule reaches the page as written.
  • ItemRepeater keys its rows by array index. Removing an item from the middle of a list re-keys every row after it, so any uncommitted local state inside those rows is discarded.

Source Files#

  • admin/editor/src/components/panels/PropertiesPanel.tsx
  • admin/editor/src/components/panels/DynamicTagPicker.tsx
  • admin/editor/src/components/panels/IconPickerModal.tsx
  • admin/editor/src/components/panels/AnimationPresetPicker.tsx
  • admin/editor/src/components/panels/TimelinePanel.tsx
  • admin/editor/src/components/classes/ClassesPanel.tsx
  • admin/editor/src/components/globalStyles/GlobalStylesPanel.tsx
  • admin/editor/src/utils/designTokens.ts
  • admin/editor/src/utils/animationPresets.ts
  • admin/editor/src/utils/iconRegistry.ts
  • admin/editor/src/store/editorStore.ts
  • admin/editor/src/types/index.ts
  • admin/editor/src/hooks/useApi.ts
  • admin/editor/src/widgets/registry.ts
  • admin/editor/src/widgets/GenericContent.tsx
  • admin/editor/src/components/canvas/CanvasNode.tsx
  • includes/class-jalpi-editor.php
  • includes/class-jalpi-settings.php
  • includes/class-jalpi-renderer.php
  • includes/class-jalpi-dynamic-tags.php
  • assets/css/frontend.css