skillfed

sphinx-togglebutton

Toggle page content and collapse admonitions in Sphinx.

sphinx-togglebutton v0.4.5 519.4K downloads/30d#6,217 on PyPI47
Permissive license MIT License Active released

What it is and what it does

sphinx-togglebutton is a Sphinx extension that adds interactive collapse/expand functionality to your documentation. It lets you hide admonitions (notes, warnings, etc.) behind toggle buttons so readers only see content when they click, and also provides a generic container directive for collapsing arbitrary sections. The extension supports showing content expanded or collapsed by default via CSS classes, and includes internationalization for toggle button labels across many languages.

You install it by adding it to your Sphinx conf.py extensions list, then mark admonitions with the `dropdown` class or use container directives with toggle classes. It requires sphinx and docutils as runtime dependencies and has no compiled components, making it straightforward to install and use in any Sphinx-based documentation workflow.

Use it for:

  • Hide verbose admonitions (warnings, notes) in documentation to reduce visual clutter while keeping them accessible
  • Collapse code examples or implementation details that readers may not need on first read
  • Create expandable FAQ or troubleshooting sections where each answer starts hidden
  • Organize long documentation pages by collapsing optional or advanced content sections

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

A Sphinx extension that adds collapsible toggle buttons to admonitions and arbitrary content sections, allowing documentation authors to hide and show content on demand.

Yes. The package is actively maintained, has no known vulnerabilities, uses a permissive MIT License, and solves a common documentation UX problem with low install friction. It's a lightweight, focused extension that integrates cleanly into Sphinx workflows.

Install

sphinx-togglebutton on PyPI

pip

pip install sphinx-togglebutton

uv

uv add sphinx-togglebutton

poetry

poetry add sphinx-togglebutton

Installing sphinx-togglebutton

Before you install

Low install friction with a pure-Python wheel distribution. The package is actively maintained with a recent release and no known vulnerabilities. Depends on standard Sphinx ecosystem packages.

License in practice

MIT License permits free use, modification, and distribution with minimal restrictions, making it suitable for both open-source and commercial documentation projects.

Quickstart

pip install sphinx-togglebutton

Then in conf.py:
extensions = ['sphinx_togglebutton']

In your .rst file:
.. note::
    :class: dropdown

    This is my note.

Verify before relying

  • Whether the extension works with all current Sphinx versions or has specific version constraints
  • Performance impact when toggling large numbers of collapsed sections

Package facts

License MIT License (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 4 — setuptools, wheel, sphinx, docutils
Maintenance actively maintained — 140 days since the last release
Last repo commit
First released
Downloads 519,405/month — #6,217 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: sphinx_togglebutton-0.4.5-py3-none-any.whl

License :: OSI Approved :: MIT License

Tags

sphinx collapsible admonitionssphinx toggle button extensionhide show sphinx contentsphinx dropdown sectionssphinx collapsible documentation
sphinx-extensiondocumentation-ux

More Sphinx packages

docstring-parser

Parses Python docstrings in ReST, Google,…

permissive · top 1,000 on PyPI

Sphinx

Sphinx generates professional documentation…

permissive · top 1,000 on PyPI

sphinxcontrib-serializinghtml

A Sphinx extension that outputs documentation…

permissive · top 1,000 on PyPI

alabaster

Alabaster is a clean, responsive Sphinx theme…

permissive · top 1,000 on PyPI

sphinxcontrib-htmlhelp

A Sphinx extension that generates HTML help…

permissive · top 1,000 on PyPI

sphinxcontrib-qthelp

A Sphinx extension that converts documentation…

permissive · top 1,000 on PyPI

sphinx-panels

A Sphinx extension that adds directives for…

permissive · top 15,000 on PyPI

sphinx-copybutton

A Sphinx extension that adds a copy button to…

permissive · top 5,000 on PyPI

sphinx-toggleprompt

Adds a button to Python code blocks in Sphinx…

permissive · top 15,000 on PyPI

sphinxcontrib-log-cabinet

A Sphinx extension that organizes changelog…

permissive · top 15,000 on PyPI

sphinx-substitution-extensions

Adds substitution support to Sphinx directives,…

permissive · top 15,000 on PyPI

sphinx-jinja

A Sphinx extension that lets you embed Jinja2…

permissive · top 5,000 on PyPI

sphinx-tabs

A Sphinx extension that adds tabbed content…

permissive · top 5,000 on PyPI

sphinxcontrib-video

A Sphinx extension that embeds HTML5 videos…

permissive · top 15,000 on PyPI

sphinx-rtd-dark-mode

Adds a toggleable dark mode interface to Sphinx…

permissive · top 15,000 on PyPI

changelog

A Sphinx extension that generates formatted…

permissive · top 15,000 on PyPI