Interface describing a widget table of contents model.

interface IModel<H> {
    activeHeading: null | H;
    activeHeadingChanged: ISignal<TableOfContents.IModel<H>, null | H>;
    collapseChanged: ISignal<TableOfContents.IModel<H>, null | H>;
    configuration: TableOfContents.IConfig;
    documentType: string;
    headings: H[];
    headingsChanged: ISignal<TableOfContents.IModel<H>, void>;
    isActive: boolean;
    isDisposed: boolean;
    stateChanged: ISignal<TableOfContents.IModel<H>, void>;
    supportedOptions: (keyof TableOfContents.IConfig)[];
    title?: string;
    toggleCollapse: ((options) => void);
    dispose(): void;
    setActiveHeading(heading, emitSignal?): void;
    setConfiguration(c): void;

Type Parameters

Hierarchy (view full)

Implemented by


activeHeading: null | H

Active heading

activeHeadingChanged: ISignal<TableOfContents.IModel<H>, null | H>

Signal emitted when the active heading changes.

collapseChanged: ISignal<TableOfContents.IModel<H>, null | H>

Signal emitted when a table of content section collapse state changes.

If all headings state are set at the same time, the argument is null.

configuration: TableOfContents.IConfig

Model configuration

documentType: string

Type of document supported by the model.


A data-document-type attribute with this value will be set on the tree view .jp-TableOfContents-content[data-document-type="..."]

headings: H[]

Returns the list of headings.


list of headings

headingsChanged: ISignal<TableOfContents.IModel<H>, void>

Signal emitted when the headings changes.

isActive: boolean

Whether the model needs to be kept up to date or not.


This is set to true if the ToC panel is visible and to false if it is hidden. But some models may require to be always active; e.g. to add numbering in the document.

isDisposed: boolean

Test whether the object has been disposed.


This property is always safe to access.

stateChanged: ISignal<TableOfContents.IModel<H>, void>

A signal emitted when any model state changes.

supportedOptions: (keyof TableOfContents.IConfig)[]

List of configuration options supported by the model.

title?: string

Document title

toggleCollapse: ((options) => void)

Callback on heading collapse.

Type declaration

    • (options): void
    • Parameters

      • options: {
            collapsed?: boolean;
            heading?: H;
        • Optional collapsed?: boolean

          The new collapsed status (toggle existing status if not provided)

        • Optional heading?: H

          The heading to change state (all headings if not provided)

      Returns void


  • Dispose of the resources held by the object.


    If the object's dispose method is called more than once, all calls made after the first will be a no-op.

    Undefined Behavior

    It is undefined behavior to use any functionality of the object after it has been disposed unless otherwise explicitly noted.

    Returns void

  • Set a new active heading.


    • heading: null | H

      The new active heading

    • Optional emitSignal: boolean

      Whether to emit the activeHeadingChanged signal or not.

    Returns void