Skip to content

Module options

Configured under nuxtToc in nuxt.config.ts (config key is camelCase nuxtToc).

OptionTypeDefaultDescription
collectionstring'content'Default collection for Content v3 auto-fetch
depthnumber2Default max nesting depth for TOC links
scrollSpybooleantrueDefault active-section highlighting
rootMarginstring'0px 0px -80% 0px'Default IntersectionObserver root margin
smoothbooleanfalseDefault smooth scroll on link click
scrollOffsetnumber0Default scroll offset (px) for sticky headers
ts
export default defineNuxtConfig({
  modules: ['nuxt-toc', '@nuxt/content'],
  nuxtToc: {
    collection: 'docs',
    depth: 2,
    scrollSpy: true,
    smooth: true,
    scrollOffset: 72,
  },
})

Component props override these defaults when set.

Released under the MIT License.