Skip to main content

Add a toggle button to items on a page.

Project description


A small sphinx extension to make it possible to add a "toggle button" to sections of your page.

demo gif


You can install sphinx-togglebutton with pip:

pip install sphinx-togglebutton


In your configuration file, add sphinx_togglebutton to your extensions list.


extensions = [

Now, whenever you wish for an admonition to be toggle-able, add the :class: toggle parameter to the admonition directive that you use.

For example, this code would create a toggle-able "note" admonition:

.. note::
    :class: toggle

    This is my note.

Clicking on the toggle button will toggle the item's visibility.

You may also hide the content by default. To do so, add the toggle class as well as a toggle-hidden class, like so:

.. note::
    :class: toggle, toggle-hidden

    This is my note.

You can also use containers to add arbitrary toggle-able code. For example, here's a container with an image inside:

.. container:: toggle, toggle-hidden

    .. admonition:: Look at that, an image!

        .. image::

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinx-togglebutton-0.2.2.tar.gz (5.2 kB view hashes)

Uploaded Source

Built Distribution

sphinx_togglebutton-0.2.2-py3-none-any.whl (6.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page