Tabs
Tabbed content with synced groups and a persisted choice, ideal for OS or language variants.
Tabs show alternative versions of the same content side by side, so readers only see what applies to them. Common uses: OS-specific install commands, language-specific code samples and before/after comparisons.
Usage
{{< tabs "os" >}}
{{< tab "Linux" >}} …content… {{< /tab >}}
{{< tab "macOS" >}} …content… {{< /tab >}}
{{< /tabs >}}The optional argument ("os") is a sync group: every block with the same group switches together site-wide, and the choice is remembered across visits.
Synced group
Switch a tab below and watch the second block flip with it:
sudo apt install hugobrew install hugochoco install hugo-extendedVerify with hugo version. Panels hold any Markdown, not just code.
Verify with hugo version. Homebrew installs to /opt/homebrew/bin.
Open a new terminal so the updated PATH applies.
Independent tabs
Omit the group argument for a standalone block that neither syncs nor persists:
{{< tabs >}}
{{< tab "JSON" >}}
```json
{ "title": "My Docs" }
```
{{< /tab >}}
{{< tab "TOML" >}}
```toml
title = "My Docs"
```
{{< /tab >}}
{{< /tabs >}}{ "title": "My Docs" }title = "My Docs"Notes
- Tabs are keyboard-accessible: focus a tab, then use
←/→/Home/End. - All panels are server-rendered, so their content is searchable and visible without JavaScript. All panels expand when printing.
- The behavior script loads only on pages that use the shortcode.