// Define your categories/tabs
const tabs = ref<TabsItem[]>([
{ label: 'Site Config', value: 'site-config' },
{ label: 'Site Utils', value: 'site-utils' },
{ label: 'Robots', value: 'robots' }
])
// Track the active tab
const activeTab = ref('site-config')
// Example: Inject or fetch all navigation trees
const allNavigation = inject<Ref<ContentNavigationItem[]>>('navigation')
// Compute the navigation for the active tab/category
const navigation = computed(() =>
allNavigation.value.find(nav => nav.title === activeTab.value)?.children || []
)
</script>
<template>
<UPage>
<template #header>
<UTabs :items="tabs" v-model="activeTab" :content="false" />
</template>
<template #left>
<UPageAside>
<UContentNavigation :navigation="navigation" highlight />
</UPageAside>
</template>
<slot />
</UPage>
</template>
- This setup uses `UTabs` for the header and dynamically updates the sidebar navigation based on the selected tab.
- You’ll need to ensure your content structure and navigation data (`allNavigation`) are organized so you can filter or select the correct navigation tree for each tab/category.
### Customizing Navigation Trees
- You may need to define content collections or structure your `content/` directory so that each top-level folder represents a category, making it easier to filter navigation items [Define Content Collections](<https://content.nuxt.com/docs/collections/define>).
- If you need more control, you can manually build the navigation trees for each section and pass them to `UContentNavigation`.
---