useHeader
Overview
useHeader() configures the desktop and mobile navigation links for the Header component.
Default implementation
It returns empty arrays by default:
export function useHeader() {
return {
desktopLinks: computed(() => []),
mobileLinks: computed(() => [])
}
}
Usage examples
Overriding the default configuration
Create composables/useHeader.ts in your project to override the default configuration:
export function useHeader() {
const route = useRoute()
return {
desktopLinks: computed(() => [
{
label: 'Docs',
to: '/docs',
icon: 'i-lucide-book',
active: route.path.startsWith('/docs')
},
{
label: 'API',
to: '/api',
icon: 'i-lucide-code',
active: route.path.startsWith('/api')
}
]),
mobileLinks: computed(() => [
{
label: 'Home',
to: '/',
icon: 'i-lucide-square-play'
},
{
label: 'Docs',
to: '/docs',
icon: 'i-lucide-book'
}
])
}
}
Internationalization support
export function useHeader() {
const { t } = useI18n()
return {
desktopLinks: computed(() => [
{
label: t('nav.docs'),
to: '/docs',
icon: 'i-lucide-book'
},
{
label: t('nav.api'),
to: '/api',
icon: 'i-lucide-code'
}
]),
mobileLinks: computed(() => [
{
label: t('nav.home'),
to: '/',
icon: 'i-lucide-square-play'
},
{
label: t('nav.docs'),
to: '/docs',
icon: 'i-lucide-book'
}
])
}
}
API
useHeader()
Returns the Header navigation link configuration.
Return values
Link object fields
Changelog
PageLastCommit
PageLastCommit automatically displays the last update time, commit author, and commit message below a documentation page's title, with automatic author detection in PR squash-merge scenarios. Requires NUXT_GITHUB_TOKEN and github.rootDir, and supports custom date formats via Intl.DateTimeFormatOptions.
useNavigation
useNavigation manages the documentation sidebar navigation tree, providing a sub-navigation list grouped by category, the set of root-level navigation items, and breadcrumb navigation data. Built on Nuxt Content's queryCollectionNavigation API, it works with useCategory to implement grouped sidebar navigation.