On this page

Tabs group related Markdown or code examples while keeping every panel readable when JavaScript is unavailable. These two groups share sync="local-shell": selecting a platform in either group updates the other and remembers the choice across pages.

Unix

zola serve

Windows

zola.exe serve

Unix

zola check

Windows

zola.exe check
{% <devlab.tabs sync="local-shell" label="Development server command"> %}
{% <devlab.tab name="Unix" value="unix" selected={true}> %}
```bash
zola serve
```
{% </devlab.tab> %}
{% <devlab.tab name="Windows" value="windows"> %}
```powershell
zola.exe serve
```
{% </devlab.tab> %}
{% </devlab.tabs> %}

devlab.tabs parameters:

ParameterRequiredDefaultDescription
syncNoEmptyShared persistence key. Groups with the same key synchronize matching tab values.
labelNoLocalized tabs_label (Tabs in English)Accessible name for the generated tab list. Provide a meaningful explicit label; an empty value retains the interactive control's existing Tabs fallback.
content_langNoCurrent page languageLanguage for the default label; explicit label is unchanged.
queryNoEmptyURL query parameter used to share the selection and restore it with Back/Forward.

devlab.tab parameters:

ParameterRequiredDefaultDescription
nameYes-Visible tab label.
valueNonameStable value used for synchronization and persistence. Values must be unique inside a group.
selectedNofalseInitial tab when no URL or saved selection matches. The first tab is the final fallback.

Use at least two devlab.tab children directly inside devlab.tabs. An empty sync value keeps the group independent and does not write a preference. A non-empty key stores only the selected value in localStorage. Explicit values are recommended when labels are translated or may change.

The enhanced control follows the horizontal tabs keyboard pattern: Left and Right move and select, while Home and End jump to the first or last tab. Arrow direction mirrors in RTL layouts.

Share a tab selection

Set query to a parameter name and use stable tab values. Selecting a tab then updates that parameter without loading a new page:

{% <devlab.tabs sync="install-platform" query="platform" label="Install platform"> %}
{% <devlab.tab name="Linux" value="linux"> %}
Linux instructions.
{% </devlab.tab> %}
{% <devlab.tab name="Windows" value="windows"> %}
Windows instructions.
{% </devlab.tab> %}
{% </devlab.tabs> %}

A link ending in ?platform=windows opens the Windows tab, even if the visitor previously saved Linux. Other parameters and unrelated fragments are preserved. Back and Forward restore previous URL choices, including the initial selection when the earlier URL had no parameter. Invalid values use the normal saved or authored fallback. Opening a shared URL does not overwrite the saved preference; actively selecting a synchronized tab still saves it.

For synchronized groups, put query on any member. Its parameter represents the whole group's value, so the query can also select a matching tab in an earlier group. A member without that value keeps its own fallback. Use distinct parameter names for independent selections. Leaving query empty on every group preserves the existing behavior without writing tab choices to the URL.

A fragment pointing to a heading inside a hidden panel opens that panel before scrolling. It also selects matching tabs in synchronized groups and opens any containing panels when tab groups are nested. The fragment takes priority over the query and saved selection.

Give the target a stable explicit ID, for example <h3 id="windows-install">Windows installation</h3> inside the tab body. This works even when the component's Markdown filter does not generate heading IDs.

When an explicit query-tab choice hides the fragment's panel, the fragment is removed from the new URL so reopening that link preserves the chosen tab. Fragments outside hidden panels remain intact. Without JavaScript, every panel and its headings remain readable.

Printing

The print stylesheet includes every panel and its label, regardless of the selected tab. Tab buttons are omitted. Printing does not change the saved screen selection.