ZuploZuplo
LoginStart for Free
  • Documentation
  • API Reference
Getting Started
Concepts
API Management
AI Gateway
MCP Gateway
MCP Server
Developer Portal
    Overview
    Getting Started
      Updating VersionsNode Modules & CustomizationZuplo Branding
      Configuration
      Writing
      OpenAPI
      Authentication
      Integrations
      Guides
      Extending
      Components
        General
        Documentation
          CodeTabsMermaidAPI PlaygroundSecretSidecar BoxStepperSyntax Highlight
        Form
        Utility
    Development
    Deploying & Source Control
    Analytics
    Observability
    Networking & Infrastructure
    Account Management
    Programming API
    Build with AI
    Zuplo CLI
    Migration Guides
    Platform LimitsVersion Support PolicySecuritySupportTrust & ComplianceChangelog
    powered by Zuplo
    Documentation

    CodeTabs

    A tabbed code block component that groups multiple code blocks into a single unified view. Useful for showing the same example in different languages or alternative commands for different package managers.

    In MDX, the CodeTabs component is available by default and doesn't need an explicit import.

    Usage

    Wrap multiple fenced code blocks with <CodeTabs> and they will render as tabs. Tab labels are automatically inferred from the code block language.

    MDXCode
    <CodeTabs> ```ts const greeting: string = "Hello, world!"; console.log(greeting); ``` ```js const greeting = "Hello, world!"; console.log(greeting); ``` ```py greeting = "Hello, world!" print(greeting) ``` </CodeTabs>

    Custom Labels

    Use the title meta attribute on each code block to set a custom tab label. This is especially useful when multiple code blocks share the same language.

    MDXCode
    <CodeTabs> ```sh title="pnpm" icon="pnpm" pnpm add zudoku ``` ```sh title="npm" icon="npm" npm install zudoku ``` ```sh title="yarn" icon="yarn" yarn add zudoku ``` </CodeTabs>

    Synced Tabs

    Use the syncKey prop to keep multiple CodeTabs instances in sync. When a user selects a tab in one group, all groups with the same syncKey update to match. The selection is persisted to localStorage and synced across browser tabs.

    MDXCode
    <CodeTabs syncKey="package-manager"> ```sh title="pnpm" icon="pnpm" pnpm add zudoku ``` ```sh title="npm" icon="npm" npm install zudoku ``` </CodeTabs> <!-- repeat above -->

    Programmatic Usage

    Usually it's recommended to use fenced code blocks in MDX files. However, when building reusable components (e.g. in your MDX component config), fenced code blocks aren't processed by the MDX pipeline. Use CodeTabPanel directly instead:

    Code
    import { CodeTabs, CodeTabPanel } from "zudoku/ui/CodeTabs"; const InstallTabs = ({ pkg }: { pkg: string }) => ( <CodeTabs syncKey="package-manager"> <CodeTabPanel language="sh" title="pnpm" icon="pnpm" code={`pnpm add ${pkg}`} /> <CodeTabPanel language="sh" title="npm" icon="npm" code={`npm install ${pkg}`} /> <CodeTabPanel language="sh" title="yarn" icon="yarn" code={`yarn add ${pkg}`} /> </CodeTabs> );

    CodeTabPanel Props

    PropTypeDescription
    codestringThe code content to display. Required.
    languagestringLanguage for syntax highlighting and label inference.
    titlestringCustom tab label. Falls back to language.
    iconstringOverride the language icon (e.g. "pnpm", "npm").
    metastringRaw meta string like in code blocks (e.g. "showLineNumbers").

    Props

    PropTypeDescription
    syncKeystringSync selected tab across all CodeTabs with the same key. Persisted to localStorage and across tabs.
    hideIconbooleanHide the language icon in tabs. Defaults to false.
    Edit this page
    Last modified on October 1, 2026
    TypographyMermaid
    On this page
    • Usage
    • Custom Labels
    • Synced Tabs
    • Programmatic Usage
      • CodeTabPanel Props
    • Props
    const greeting: string = "Hello, world!"; console.log(greeting);
    pnpm add zudoku
    pnpm run build
    pnpm run build
    React