Tabs widget
The complete guide to the WidgetCore Tabs widget — repeater items, horizontal and vertical layout, ARIA roles, keyboard navigation and every style control.
The Tabs widget splits content into panels and shows one of them at a time. The markup is fully accessible: a tablist, every tab with role="tab", every panel with role="tabpanel", roving tabindex and keyboard navigation.
| Item | Value |
|---|---|
| Widget name | wgcr-tabs |
| Panel title | Tabs |
| Category | WidgetCore Widgets (wgcr) |
| Style / script | wgcr-tabs / wgcr-tabs |
| Root class | .wgcr-tabs |
The “Tabs” section
The section holds one repeater called Items (items). Each row has a title and a content type, and the matching field appears based on that type:
| Field | ID | Type | Default | Notes |
|---|---|---|---|---|
| Tab title | tab_title | Text | “Tab title” | The text shown on the tab button |
| Tab content type | content_type | Select | Text (visual editor) | Text (visual editor) / Elementor template / Custom code (HTML) |
| Tab content | tab_content | WYSIWYG | “Tab content…” | Only for the "Text" type; links and simple formatting are allowed |
| Select a template | tab_template | Template picker (SELECT2) | — | Only for the "Elementor template" type; lists the published templates of the Elementor library |
| Custom code | tab_html | Code (TEXTAREA) | — | Only for the "Custom code" type |
The three content types of a tab
- Text (visual editor): the classic behavior — the content is printed through the safe
wp_kses_postfilter and Elementor inline editing works in the editor. - Elementor template: any template saved in the Elementor library (a section, a page or any other layout) is printed inside the panel with its own styles; under the hood the widget uses the
[wgcr_template]shortcode. In the editor a reminder note is shown instead of the template; the real output appears in the page/preview view. - Custom code (HTML): your code is printed unfiltered, exactly like Elementor's own HTML widget, and any scripts inside it execute — for embeds, iframes, manual schema or ad code. The correctness and safety of that code is your responsibility.
On first use the widget is filled with three sample tabs; replace their text with your own content.
The “Behaviour” section
| Control | ID | Type | Values | Default |
|---|---|---|---|---|
| Tabs layout | mode | Select | Horizontal (tabs above the content) / Vertical (tabs beside the content) | Horizontal |
| Wrap tabs into multiple rows | wrap | Switcher | On / Off | On |
Vertical layout puts the tab list beside the panels and sets aria-orientation="vertical". “Wrap tabs into multiple rows” only affects the horizontal layout: when the tabs are wider than the column they flow into the next row.
HTML output
<div class="wgcr-tabs" data-mode="horizontal" data-wrap="1">
<div class="wgcr-tabs-nav" role="tablist" aria-orientation="horizontal">
<button type="button" role="tab" class="wgcr-tab wgcr-tab-active" id="wgcr-tabs-t-…"
aria-selected="true" aria-controls="wgcr-tabs-p-…" tabindex="0"><span>Title</span></button>
<button type="button" role="tab" class="wgcr-tab" id="wgcr-tabs-t-…"
aria-selected="false" aria-controls="wgcr-tabs-p-…" tabindex="-1"><span>Title</span></button>
</div>
<div class="wgcr-panels">
<div role="tabpanel" class="wgcr-panel" id="wgcr-tabs-p-…" aria-labelledby="wgcr-tabs-t-…" tabindex="0"><div>Content</div></div>
<div role="tabpanel" class="wgcr-panel" id="wgcr-tabs-p-…" aria-labelledby="wgcr-tabs-t-…" tabindex="0" hidden><div>Content</div></div>
</div>
</div>
| Class / role | Purpose |
|---|---|
.wgcr-tabs | Widget root; data-mode carries the layout and data-wrap the row wrapping |
.wgcr-tabs-nav | The tab list with role="tablist" |
.wgcr-tab | Each tab button with role="tab"; the active one also gets wgcr-tab-active |
.wgcr-panels | The container of all panels |
.wgcr-panel | Each panel with role="tabpanel"; inactive panels are hidden |
Keyboard and accessibility
| Key | Behaviour |
|---|---|
| Tab | Only the active tab is in the tab order (roving tabindex); one more Tab lands in its panel |
| Arrow keys (all four) | Move to the previous/next tab, wrapping around, and move the focus |
| Home / End | First and last tab |
| Enter / Space | Activate the focused tab button |
Screen readers see aria-selected, aria-controls and aria-labelledby, so the active tab and its panel are always clear. The script is tiny, dependency-free and loads only on pages that use the widget; without JavaScript the first tab is already active and the other panels are hidden.
Style sections
- General: “Gap between tabs” and “Gap between the list and the content” (responsive sliders).
- Tab buttons: “Tab background”, “Tab text color” and “Tab border color” in the normal state; “Active tab background” and “Active tab text color” for the active tab; “Background on hover” and “Text color on hover” for hover; plus typography, “Tab padding” and “Tab corner radius”, and the panel-side “Text color”.
- Tab content: a ready-made box group (background, border, shadow, padding, radius) for the panel, its text color and typography.
Custom style example
/* Pill-shaped tabs with a green accent */
.wgcr-tabs .wgcr-tab { border-radius: 999px; }
.wgcr-tabs .wgcr-tab-active { background: #16a34a; color: #fff; }