Tabs are the optimal UI pattern for presenting mutually exclusive or related data sets (e.g., “Install via NPM vs. Yarn” or “macOS vs. Windows” instructions) within a compact, interactive format.

Syntax Reference

The tabs container utilizes the specialized sub-delimiter == tab "Label". Each label defines a distinct pane that users can toggle between.

::: tabs

== tab "Label 1"
Content for the first tab.

== tab "Label 2"
Content for the second tab.

:::

Tabs are most commonly used to show installation instructions for different package managers in a single view.

pnpm
npm
yarn
pnpm add @docmd/core
npm install @docmd/core
yarn add @docmd/core

Keep your logic clean by separating different programming languages or environments.

TypeScript
JavaScript
import { build } from '@docmd/core';
await build('./docmd.config.js');
const { build } = require('@docmd/core');
build('./docmd.config.js');

Core Capabilities

Isomorphic Lazy Rendering

docmd implements Conditional Resource Laziness. If a tab contains computationally expensive elements (e.g., Mermaid.js diagrams or high-resolution images), these assets are only initialized and rendered once the user activates that specific tab. This ensures rapid initial page loads.

State Persistence

The default SPA router tracks the active tab’s index across similar documentation pages. If a user selects “pnpm” on one page and navigates to another page with a matching tab structure, the “pnpm” tab will remain active automatically.

Technical Constraints

Constraint Note
Nesting Depth To preserve layout integrity, tabs cannot be nested inside other tab components.
Interactive Conflict High-conflict syntax: To nest Steps inside a Tab, use a standard ordered list (1. Step One) instead of the ::: steps container.
Responsive Limit It is recommended to limit tab counts to 6 per block to ensure mobile device compatibility.
AI Context Mapping

When utilizing tabs for code snippets, always include the target language directly in the tab label (e.g., == tab "TypeScript"). This allows LLMs to instantly identify and extract the technically relevant section from the llms-full.txt context stream.