Table Of Contents

Table of contents navigation component.

python 6 params

Preview

Arguments
table_of_contents(items=[{'id': 'intro', 'label': 'Introduction'}, {'id': 'usage', 'label': 'Usage'}, {'id': 'props', 'label': 'Parameters'}], active='usage')

Usage

views.py
python
from djust import LiveView
from djust.components import TableOfContents


class MyView(LiveView):
    template_name = "my_template.html"

    def mount(self, request, **kwargs):
        self.component = TableOfContents(items=[{'id': 'intro', 'label': 'Introduction'}, {'id': 'usage', 'label': 'Usage'}, {'id': 'props', 'label': 'Parameters'}], active='usage')
my_template.html
django
{{ component }}

Parameters

NameTypeDefault
itemslist | NoneNone
titlestr'Contents'
activestr''
eventstr — renames the event; identity is `name`''
custom_classstr''
**kwargs— passed to `Component.__init__`: `name=` identifies the instance in the events it sends, `id=` sets `component.id`, and any other keyword is kept as state
Source & styles
FilePathNotes
moduledjust.components.components.table_of_contentsSubclass it, or pass custom_class, to change how it renders.
cssdjust_components/components.cssDefines 5 of this component's classes at line 902, 903, 904, 905, 907. Override those rules, or the custom properties they read, in a stylesheet loaded after it.
cssdjust_theming/catalogue.cssDefines 3 of this component's classes at line 99, 100, 102. Override those rules, or the custom properties they read, in a stylesheet loaded after it.