2.17.0

Table of Contents

Table of Contents is a navigation list, usually found on an article page, of its section titles.

Published

History
View changes
Install
yarn add @bolt/components-toc
Source code
View on Github
Dependencies

Table of Contents is part of the collection of components, visual styles, and build tools that power the the Bolt Design System.

Install via NPM
npm install @bolt/components-toc
  {% include "@bolt-components-toc/toc.twig" with {
  items: [
    {
      text: "Section 1",
      url: "#section-1"
    },
    {
      text: "Section 2",
      url: "#section-2"
    },
  ]
} only %}

Note: when assigning component props as HTML attributes on a web component, make sure to use kebab-case.

Prop Name Description Type Default Value Option(s)
Attributes

A Drupal attributes object. Applies extra HTML attributes to the outer <bolt-toc> tag.

object
Items

Generates an array of items. The items represent the headlines of top level sections in an article.

array
  • [items]:
    • Type: object

      Renders a linked item that points to the beginning of a particular section.

    • Properties:
      • text

        Renders the text for the linked item.

        • Type: string
      • url

        Renders the href for the linked item. This should be the id of the responding section. For example: #section-one-name.

        • Type: string
      • active

        Indicates that the item represents the current section being viewed.

        • Type: boolean
Header

Renders a header for the table of contents.

string
Uuid

Unique ID for the table of contents, randomly generated if not provided.

string
Debug Panel