Valkyrian Labs

Tabs

Use tabs for package-manager examples, comparisons, and compact server-rendered content groups.

Tabs

Use :::tabs with child :::tab directives for package-manager examples, feature comparisons, and compact docs sections.

1:::tabs{2  default="pnpm"3  theme="glass"4}5 6:::tab[pnpm]{value="pnpm"}7```bash8pnpm add payload-markdown9```10:::11 12:::tab[npm]{value="npm"}13```bash14npm install payload-markdown15```16:::17 18:::

:::tabs

tabs attributes
AttributeTypeDefaultSummary
stringfirst tabSelected tab value on first render.
stringdefaultTabs container theme.
paletteColour palette for the surface, border and links (see Palettes).
stringDefault child tab panel theme.
stringKey shared by tab sets that switch together (see Synced Tabs).

When default is missing or does not match a child tab value, the first tab is selected.

:::tab

tab attributes
AttributeTypeDefaultSummary
textVisible tab label, preferred for new Markdown.
textVisible tab label retained for existing Markdown.
stringfrom the labelStable tab identity.
stringTab panel theme.
flagOptional disabled trigger state.

If value is missing, the renderer derives one from [Label] or label. If both are missing, it generates a safe fallback.

Nested Markdown

Tab panels support normal Markdown, code fences, and nested directives:

1:::tabs{default="install"}2 3:::tab[Install]{value="install"}4```bash5pnpm add payload-markdown6```7:::8 9:::tab[Notes]{value="notes"}10:::callout[Portable content]{variant="tip"}11Tabs still store as plain Markdown directives.12:::13:::14 15:::

Duplicate Values

Duplicate tab values are slugged and made unique in rendered output, but diagnostics warn when duplicates are found. Use stable explicit values when tabs appear in long-lived docs:

1:::tab[pnpm]{value="pnpm"}

Disabled Tabs

Use disabled when a tab should render but not be selectable:

1:::tab[Coming soon]{value="soon" disabled}2Content can stay in source while the trigger is disabled.3:::

disabled="false" keeps the tab enabled.

Interactivity And Accessibility

Tabs render accessible server HTML with role="tablist", role="tab", and role="tabpanel".

The renderer progressively enhances tabs on the client:

  • clicking a trigger switches panels
  • arrow keys move between triggers
  • Home and End jump to the first and last triggers
  • Enter and Space activate a focused trigger

There is no URL hash for tabs. Tab sets that share a sync key switch together and remember the reader's choice (below).

Synced Tabs

Give tab sets that offer the same choice the same sync key. Picking a tab in one switches every other set on the page with that key, and the choice is remembered for the next visit:

1:::tabs{sync="os"}2 3:::tab[Linux]{value="linux"}4```bash5sudo apt install orbit6```7:::8 9:::tab[macOS]{value="macos"}10```bash11brew install orbit12```13:::14 15:::16 17Later on the same page:18 19:::tabs{sync="os"}20 21:::tab[Linux]{value="linux"}22Config lives in `/etc/orbit/orbit.toml`.23:::24 25:::tab[macOS]{value="macos"}26Config lives in `~/Library/Application Support/orbit/orbit.toml`.27:::28 29:::
  • Sets match by tab value, so use the same values in every set with the key. A set without a tab of that value, or whose tab of that value is disabled, keeps its current tab.
  • Every renderer on the page takes part, so separate Markdown blocks with the same key switch together too.
  • The choice is stored in the browser's localStorage under payload-markdown:tabs-sync:<key> and applied when the page loads. When storage is unavailable the sets still switch together; the choice is just not kept.
  • Switching sets above the one the reader clicked keeps the clicked tab where it was on screen, so the page does not jump.
  • Without JavaScript each set shows its own default, as an unsynced set does.

An empty or bare sync (sync="", {sync}) is reported as invalid-tabs-sync and ignored.

Themes

Built-in tabs container themes:

  • default
  • muted
  • glass
  • underline
  • pills

Built-in tab panel themes:

  • default
  • muted
  • glass