{% set toc_items %}
{% include '@bolt-components-toc/toc-item.twig' with {
text: 'Section One',
url: '#section-one',
} only %}
{% include '@bolt-components-toc/toc-item.twig' with {
text: 'Section Two',
url: '#section-two',
} only %}
{% include '@bolt-components-toc/toc-item.twig' with {
text: 'Section Three',
url: '#section-three',
} only %}
{% endset %}
{% include '@bolt-components-toc/toc.twig' with {
header: 'This is the header',
content: toc_items
} only %}
Prop Name | Description | Type | Default Value | Option(s) |
---|---|---|---|---|
attributes
|
A Drupal attributes object. Applies extra HTML attributes to the outer <bolt-toc> tag. |
object
| — |
|
header
|
Renders a header for the table of contents. If not specified, the default value will be used and the header will be visually hidden but accessible to screen readers. |
string
|
Table of Contents
|
|
sticky
|
When enabled, TOC will automatically use sticky positioning + add a |
boolean
| — |
|
variant
|
Set the visual variant. |
string
|
card
|
|
scroll_offset
|
Additional offset for smooth scrolling, an integer converted to pixel value. |
integer
| — |
|
content
|
Generates toc items. Accepts @bolt-components-toc-item |
object
| — |
|
Prop Name | Description | Type | Default Value | Option(s) |
---|---|---|---|---|
attributes
|
A Drupal attributes object. Applies extra HTML attributes to the outer <bolt-toc> tag. |
object
| — |
|
text
|
Renders the text for the linked item. |
string
| — |
|
url
|
Renders the |
string
| — |
|
active
|
Indicates that the item represents the current section being viewed. |
boolean
| — |
|
npm install @bolt/components-toc