Manually Set an Item as Active
Any item can be set to active to indicate that the page is anchored to the respective section.
Demo
Section One
Section Two
Section Three
Twig
{% include '@bolt-components-toc/toc.twig' with {
items: [
{
text: 'Section One',
url: '#section-one',
},
{
text: 'Section Two',
url: '#section-two',
active: true,
},
{
text: 'Section Three',
url: '#section-three',
},
]
} only %}
HTML
<bolt-toc>
<bolt-toc-item url="#section-one">
Section One
</bolt-toc-item>
<bolt-toc-item url="#section-two" active>
Section Two
</bolt-toc-item>
<bolt-toc-item url="#section-three">
Section Three
</bolt-toc-item>
</bolt-toc>