Skip to content
duxt

useActiveHeading()

The heading currently in view.

Signature

const active = useActiveHeading(ids);

Returns

The id of the heading the reader is currently at.

Notes

It watches the headings rather than the scroll offset, so a short last section is still reported as reached — the common failure of a scroll-position table of contents.

Was this page helpful?