PageBuilder
Visual section builder for MODX 3. Draft and publish without overwriting resource content

Split long content into tabs: shipping, payment, specs. Each tab body is richtext HTML.
Информация
Requires PageBuilder Pro.
Tabs repeater: Tab label, Anchor (Latin slug), Content. Front-end switching uses pagebuilder-sections.js.
| Parameter | Value |
|---|---|
| key | tabs |
| Layer | Pro |
| Category | content (content) |
| Chunk | pagebuilderpro_tabs |
| Requires | pro |
Fill these fields in the section inspector. Field types are documented in the field types reference.
title) Type text. Optional.
items) Type repeater. Required. Repeatable rows. "Add" button in the inspector.
Each row:
| Field | Type | Label | Required |
|---|---|---|---|
label | text | Tab label | yes |
anchor | slug | Anchor | no |
content | richtext | Content | yes |
pb-tabs with panels. Include section JS in your template.
Example payload after save. Media, video, and map values may be enriched on output:
{
"title": "Section title",
"items": [
{
"_rowId": "00000000-0000-4000-8000-000000000001",
"label": "Happy customers",
"anchor": "tab-delivery",
"content": "<p>Page text with <strong>formatting</strong>.</p>"
}
]
}Fenom chunk pagebuilderpro_tabs:
{var $tabCount = $items|count}
<section class="pb-section pb-section--tabs pb-tabs{if $cssClass} {$cssClass|escape}{/if}" data-pb-section="tabs" data-pb-tabs{if $id} id="pb-{$id|escape}"{/if}>
<div class="pb-section__inner pb-tabs__inner">
{if $title}
<h2 class="pb-heading pb-tabs__title">{$title|escape}</h2>
{/if}
{if $tabCount > 0}
<div class="pb-tabs__nav" role="tablist" aria-label="{$title|default:'Tabs'|escape}">
{foreach $items as $item}
{var $anchor = $item.anchor|default:('tab-' ~ $item@index)}
<button
type="button"
class="pb-tabs__tab{if $item@first} pb-tabs__tab--active{/if}"
id="pb-tab-{$id|default:'section'}-{$item@index}"
role="tab"
aria-selected="{if $item@first}true{else}false{/if}"
aria-controls="pb-panel-{$id|default:'section'}-{$item@index}"
data-pb-tab="{$item@index}"
data-pb-anchor="{$anchor|escape}"
>
{$item.label|escape}
</button>
{/foreach}
</div>
<div class="pb-tabs__panels">
{foreach $items as $item}
{var $anchor = $item.anchor|default:('tab-' ~ $item@index)}
<div
class="pb-tabs__panel{if $item@first} pb-tabs__panel--active{/if}"
id="pb-panel-{$id|default:'section'}-{$item@index}"
role="tabpanel"
aria-labelledby="pb-tab-{$id|default:'section'}-{$item@index}"
data-pb-panel="{$item@index}"
data-pb-anchor="{$anchor|escape}"
{if !$item@first}hidden{/if}
>
<details class="pb-tabs__accordion">
<summary class="pb-tabs__accordion-summary">{$item.label|escape}</summary>
<div class="pb-tabs__accordion-body pb-richtext__content">{$item.content}</div>
</details>
<div class="pb-tabs__desktop pb-richtext__content">{$item.content}</div>
</div>
{/foreach}
</div>
{/if}
</div>
</section>PageBuilderPro/core/components/pagebuilderpro/sections/tabs.json