Tabs

Create tabbed content in Sphinx documentation. Perfect for showing code examples in multiple languages.

ui

About this Extension

Creates tabbed interfaces for organizing related content. Commonly used to show the same example in multiple programming languages or different approaches to the same task.

Use cases

  • Code examples in multiple programming languages
  • Different installation methods (pip, conda, docker)
  • Platform-specific instructions (Windows, macOS, Linux)
  • Alternative configuration options
  • Before/after comparisons

Basic syntax

.. tabs::

   .. tab:: Python

      .. code-block:: python

         print("Hello World")

   .. tab:: JavaScript

      .. code-block:: javascript

         console.log("Hello World");

Advanced features

Group tabs that sync across the page:

.. tabs::

   .. group-tab:: Python

      Python content here

   .. group-tab:: JavaScript

      JavaScript content here

When a user clicks “Python” in one tab group, all other tab groups on the page will automatically switch to their “Python” tab.

Configuration

# conf.py
extensions = ['sphinx_tabs']

# Optional: set default tab
sphinx_tabs_default_tab = "python"

Works with any content type - code blocks, text, images, or other directives.

Author

Executable Book Project

License

MIT License

Try it out!

We have not been able to validate your subscription.
You have been subscribed to SphinxThemes.com

We've got more coming...

Join the community and get notified every time we list a new Sphinx theme or extension.