Composables

Discover the Docus composables.

useDocus()

useDocus() gives access to docus runtime config, all default values and your custom config from app.config.ts

<script setup>const docus = useDocus()</script><template>  <div>    <h1>{{ docus.title }}</h1>    <p>{{ docus.description }}</p>  </div></template>

useCurrentNavigation()

useCurrentNavigation() gives access to current navigation calculated from @nuxt/content navigation object and features in theme and pages front-matter.

const {  // Navigation object  tree,  // Aside config computed from front-matter and theme config  asideConfig} = useCurrentNavigation()

useMenu()

useMenu() gives access to $menu plugin controlling mobile navigation globally.

const {  // Is menu visible  visible,  // Close menu function  close,  // Open menu function  open,  // Toggle menu function  toggle} = useMenu()

useRepository()

useRepository() gives access to repository informations given by GitHub package.

That can be useful to build UI from live repository informations.

const {  // Repository informations  repository,  // Last release  last} = useRepository()

useScrollspy()

useScrolspy() 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()