---
title: "useDocsNavigation"
description: "Read the docs navigation tree that the shell has already loaded. The header section bar, sidebar and docs pages all take their navigation from here, so custom components reuse the same data without querying the collection again."
canonical_url: "https://docs.mhaibaraai.cn/en/docs/reference/composables/use-docs-navigation"
---
# useDocsNavigation

> Read the docs navigation tree that the shell has already loaded. The header section bar, sidebar and docs pages all take their navigation from here, so custom components reuse the same data without querying the collection again.

`useDocsNavigation()` returns the navigation tree that [`useDocsShell`](https://docs.mhaibaraai.cn/en/docs/reference/composables/use-docs-shell) provides in `app.vue`, already loaded and transformed for the current locale.

## Usage

```vue [app/components/SectionList.vue]
<script setup lang="ts">
const navigation = useDocsNavigation()
</script>

<template>
  <ul>
    <li v-for="section in navigation" :key="section.path">
      <NuxtLink :to="section.path">
        {{ section.title }}
      </NuxtLink>
    </li>
  </ul>
</template>
```

## Signature

```ts
function useDocsNavigation(): Ref<ContentNavigationItem[] | undefined>
```

## Return Value

| Name | Type | Description |
| --- | --- | --- |
| (return value) | `Ref<ContentNavigationItem[] \| undefined>` | Top-level sections under the docs root; each `children` holds the section's pages, and the `category` and `description` frontmatter fields are kept on each node |

## Notes

- Call it inside the component tree of `app.vue` or `error.vue`. Outside the shell (for example a custom `app.vue` that does not call `useDocsShell`) you get a ref whose value is `undefined`.
- The injection key is the string `'navigation'`. v2 code that calls `inject('navigation')` directly still works; new code should use this function.
- To group by category or build breadcrumbs, pass the result to [`useNavigation`](https://docs.mhaibaraai.cn/en/docs/reference/composables/use-navigation).

## Changelog

See commit history for [layer/app/composables/useDocsShell.ts](https://github.com/mhaibaraai/movk-nuxt-docs/commits/main/layer/app/composables/useDocsShell.ts).

---

- [GitHub](https://github.com/mhaibaraai/movk-nuxt-docs/blob/main/layer/app/composables/useDocsShell.ts)


## Sitemap

See the full [sitemap](https://docs.mhaibaraai.cn/sitemap.md) for all pages.
