useDocsShell
The layer's app.vue and error.vue both start with await useDocsShell(). If you override either of them in your project, you must call it too; otherwise useDocsNavigation, the header section bar and the sidebar get no navigation data.
Usage
<script setup lang="ts">
const { nuxtUiLocale, rootNavigation, files } = await useDocsShell()
</script>
<template>
<UApp :locale="nuxtUiLocale">
<Header />
<NuxtLayout>
<NuxtPage />
</NuxtLayout>
<Footer />
<ClientOnly>
<UContentSearch :files="files" :navigation="rootNavigation" />
</ClientOnly>
</UApp>
</template>
The example keeps only the minimal shell. The layer's app.vue also mounts the AI Chat panel, the recent pages group in ⌘K and useLocaleSeo(); start from a copy of it when rewriting.
Signature
function useDocsShell(): Promise<{
nuxtUiLocale: ComputedRef<Locale>
rootNavigation: ComputedRef<ContentNavigationItem[]>
files: Ref<ContentSearchSection[] | undefined>
}>
Return Value
| Name | Type | Description |
|---|---|---|
nuxtUiLocale | ComputedRef<Locale> | The @nuxt/ui/locale messages for the current locale, falling back to en; pass it to UApp's locale |
rootNavigation | ComputedRef<ContentNavigationItem[]> | Top-level section navigation, also provided to the component tree under the 'navigation' key |
files | Ref<ContentSearchSection[] | undefined> | Full-text search index for the current locale, lazily loaded on the client only; pass it to UContentSearch |
Side Effects
Calling it registers:
- A navigation request keyed per locale (
docs-navigation-{locale}) that includes the pages'categoryanddescriptionfields. langanddiron<html>,data-font="sans"whentheme.fontissans, anddata-grainwhentheme.grainis on.viewportandtheme-colormeta tags, plus the radius and black-as-primary styles fromuseTheme.
Notes
awaitit at the top level of<script setup>. The function finishesprovideanduseHeadbefore its onlyawait; do not add anotherawaitbefore calling it.- Multilingual SEO is not part of the shell; call
useLocaleSeo()separately.
Changelog
useDocsFilterConfig
Config, visibility check and filter function behind the sidebar navigation filter, mapped to aside.filter in app.config. Use them in a custom sidebar top or sidebar body component to keep the default filtering behavior.
A–Z Index
Every documentation page listed alphabetically by title. Use it when you remember the name of a feature but not which section it lives in.