TocScrollSpy class
A client-side component that highlights the active TOC link based on scroll.
Uses Jaspr's @client annotation for client-side hydration.
On the client, sets up an IntersectionObserver to watch heading elements
and toggles the active class on corresponding .toc-link elements.
Renders nothing on the server — the visual TOC is rendered by TableOfContents. Place this component alongside TableOfContents:
Row(children: [
Expanded(child: div(classes: 'docs-content', [RawText(html)])),
TableOfContents(entries: toc),
TocScrollSpy(),
])
- Inheritance
-
- Object
- Component
- StatefulComponent
- TocScrollSpy
- Available extensions
- Annotations
Constructors
- TocScrollSpy({Key? key})
-
const
Properties
Methods
-
apply(
{String? id, String? classes, Styles? styles, Map< String, String> ? attributes, Map<String, EventCallback> ? events}) → Component -
Available on Component, provided by the ComponentApplyExtension extension
-
createElement(
) → Element -
Creates a StatefulElement to manage this component's location in the tree.
inherited
-
createState(
) → State< TocScrollSpy> -
Creates the mutable state for this component at a given location in the tree.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited