container β Content container inside a Section. Supports block, flex and CSS-grid layout modes. It is a structural node: it holds children and participates in the layout tree.
Identity#
| Field | Value |
|---|---|
| Widget name | Container |
Node type (node.type) | container |
| Palette group | Layout |
| Implementation path | Structural (layout node with children) |
| Available in the Elements panel | Yes |
| PHP element class | Jalpi_Element_Container |
| Editor canvas preview | ContainerRenderer |
| Inspector Content tab | β (no content controls) |
| Inspector Style tab | Shared StyleTab |
| Needs the frontend script | No |
Purpose#
Content container inside a Section. Supports block, flex and CSS-grid layout modes.
Where it is registered#
Editor β WIDGET_REGISTRY in admin/editor/src/widgets/registry.ts with bespoke: true. The registry entry carries palette metadata and the seed defaultNode only; behaviour comes from the dedicated components.
Server β Jalpi_Element_Container is listed in Jalpi_Renderer::register_elements() and keyed by its type() return value, 'container'.
Sanitizer β 'container' is in the $allowed_types array of Jalpi_Sanitizer::sanitize_node().
Content schema (node.content)#
This type stores no content object. Its configuration lives in node.settings and node.styles.
Settings schema (node.settings)#
Keys accepted by Jalpi_Sanitizer::sanitize_settings() for this type, in addition to the shared keys every node has (cssId, cssClass, cssClasses, customCss, bgNormal/bgHover, overlayNormal/overlayHover, borderNormal/borderHover, and the st_* Split Animation group).
| Key | Type / allowed values | Default | Notes |
|---|---|---|---|
layoutMode | 'block' | 'flex' | 'grid' | 'block' | Selects which group of layout keys applies |
contentWidth / boxedWidth | 'full' | 'boxed' / CSS length | 'full' | Container width behaviour |
alignItems / columnGap | flex keyword / CSS length | β | Block-mode alignment and gap |
flexDirection | row | column | row-reverse | column-reverse | 'row' | Flex mode |
flexWrapMode | nowrap | wrap | wrap-reverse | 'nowrap' | Flex mode |
flexJustify | flex-start | center | flex-end | space-between | space-around | space-evenly | 'flex-start' | Flex mode |
flexAlign | flex-start | center | flex-end | stretch | baseline | β | Flex mode |
flexGap | CSS length | β | Flex mode |
gridAutoMode | 'none' | 'fill' | 'fit' | 'none' | Grid mode β auto-fill / auto-fit |
gridColumns | integer 1β12 | β | Grid mode, clamped server-side |
gridRows | integer β₯ 1 or empty | β | Grid mode |
gridGap / gridMinColSize | CSS length | β | Grid mode |
columns | integer (legacy) | 1 | Kept for pages saved before layoutMode existed |
Rendering#
Editor canvas β ContainerRenderer in admin/editor/src/components/canvas/CanvasNode.tsx. CanvasNode builds the inline preview style by layering Design-System token values, attached reusable classes, the node's own styles, then the active breakpoint's tabletStyles/mobileStyles.
Frontend β Jalpi_Element_Container::render() returns a single root tag scoped by the CSS selector .jalpi-container.jalpi-{id}, and pushes its rule set into the renderer with $renderer->add_css(). That single-root-tag contract is what lets the interaction engine inject data-jalpi-interact on any widget without per-widget code.
Behaviour β static markup only; this widget does not cause the frontend script to be enqueued.
Capabilities inherited from the node model#
Every node type β including this one β gets the following for free, because they operate on the tree rather than on any single widget:
- Style tab β typography, colours, background, border, shadow, spacing.
- Advanced tab β margin, padding, per-device visibility, CSS ID / class, reusable classes, per-element Custom CSS.
- Responsive overrides β
tabletStylesandmobileStylessibling maps, plushideOn. - Animation tab β the Interaction Engine (
node.interactions) and the Split Animation group (settings.st_*). - Design System links β
node.globalStyleReffor atomic tokens and composite typography/button presets. - Editor operations β copy, paste, duplicate, lock, drag-reorder, undo/redo, save as template, revision history.
Code Examples#
Minimal node JSON#
The shape this widget takes inside `page_data.sections`. Ids must be unique across the whole tree.
{
"id": "container_a1b2c3d",
"type": "container",
"styles": {},
"children": []
}Notes#
Good to know
gridColumnsis clamped to 1β12 andflex*/grid*values are validated against fixed allow-lists inJalpi_Sanitizer::sanitize_settings().
Source
Files
includes/elements/class-jalpi-element-container.php admin/editor/src/components/canvas/CanvasNode.tsx admin/editor/src/widgets/registry.ts includes/class-jalpi-sanitizer.php includes/class-jalpi-renderer.php
Classes
Jalpi_Element_Container
Functions
render type
Last updated: November 2026