Composables

Composable functions exported by shadcn-docs-nuxt.

useConfig()

Get the config from app.config.ts.

  • main, header, aside, footer and toc can be set from _dir.yml and any page.md file.
const {
  site,
  search,
  header,
  main,
  aside,
  footer,
  toc,
} = useConfig();

useScrollspy()

Modified from docus. useScrollspy() is used in docs layout to make the ToC display the currently visible headings.

const {
  // Headings on the page
  visibleHeadings,
  // Active headings (for the current page)
  activeHeadings,
  // Update headings (an array of DOM nodes)
  updateHeadings
} = useScrollspy();