sphinx-togglebutton
Toggle page content and collapse admonitions in Sphinx.
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-togglebuttonuv
uv add sphinx-togglebuttonpoetry
poetry add sphinx-togglebuttonInstalling 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
Tags
More Sphinx packages
Parses Python docstrings in ReST, Google,…
permissive · top 1,000 on PyPI
SphinxSphinx generates professional documentation…
permissive · top 1,000 on PyPI
sphinxcontrib-serializinghtmlA Sphinx extension that outputs documentation…
permissive · top 1,000 on PyPI
alabasterAlabaster is a clean, responsive Sphinx theme…
permissive · top 1,000 on PyPI
sphinxcontrib-htmlhelpA Sphinx extension that generates HTML help…
permissive · top 1,000 on PyPI
sphinxcontrib-qthelpA Sphinx extension that converts documentation…
permissive · top 1,000 on PyPI
sphinx-panelsA Sphinx extension that adds directives for…
permissive · top 15,000 on PyPI
sphinx-copybuttonA Sphinx extension that adds a copy button to…
permissive · top 5,000 on PyPI
sphinx-togglepromptAdds a button to Python code blocks in Sphinx…
permissive · top 15,000 on PyPI
sphinxcontrib-log-cabinetA Sphinx extension that organizes changelog…
permissive · top 15,000 on PyPI
sphinx-substitution-extensionsAdds substitution support to Sphinx directives,…
permissive · top 15,000 on PyPI
sphinx-jinjaA Sphinx extension that lets you embed Jinja2…
permissive · top 5,000 on PyPI
sphinx-tabsA Sphinx extension that adds tabbed content…
permissive · top 5,000 on PyPI
sphinxcontrib-videoA Sphinx extension that embeds HTML5 videos…
permissive · top 15,000 on PyPI
sphinx-rtd-dark-modeAdds a toggleable dark mode interface to Sphinx…
permissive · top 15,000 on PyPI
changelogA Sphinx extension that generates formatted…
permissive · top 15,000 on PyPI