Add interactive data tables

Data-heavy documentation often benefits from tables that users can explore interactively. The Sphinx DataTables extension provides interactive tables where users can sort columns and filter rows, making large datasets more navigable and useful. For examples, see the extension’s documentation.

The extension isn’t available by default in the Sphinx Stack. To read more about table functionality that is available out of the box, see Tables (MyST) and Tables (reST).

Include the sphinx-datatables extension

To include the extension in your documentation, add sphinx-datatables to docs/requirements.txt.

Then, add sphinx_datatables to the extensions list in docs/conf.py.

Make a table interactive by adding a special CSS class to the directive:

.. csv-table::
    :class: sphinx-datatable
    :file: /how-to/assets/animals.csv
    :header-rows: 1
```{csv-table}
:class: sphinx-datatable
:file: /how-to/assets/animals.csv
:header-rows: 1
```