useCategory
useCategory() reads docs.categories from app.config and resolves category titles for the current locale. useNavigation uses it to group pages.
Recommended: Declare in app.config
Keys are the slugs of top-level section directories (without the numeric prefix); values are category lists, and list order is sidebar order:
export default defineAppConfig({
docs: {
categories: {
guide: [
{ id: 'basics', title: { 'zh-CN': '基础', 'en': 'Basics' }, icon: 'i-lucide-settings' },
{ id: 'shipping', title: { 'zh-CN': '发布', 'en': 'Shipping' }, icon: 'i-lucide-rocket' }
]
}
}
})
Pages join a category through the category frontmatter field:
---
title: Deployment
category: shipping
---
See Navigation and Categories for details.
Signature
function useCategory(): {
categories: ComputedRef<Record<string, Category[]>>
}
interface Category {
id: string
title: string
icon: string
}
Return Value
| Name | Type | Description |
|---|---|---|
categories | ComputedRef<Record<string, Category[]>> | Keys are section slugs, values are that section's categories with title resolved for the current locale |
Overriding
Create a same-named file in your project. The return shape must stay { categories }:
export function useCategory() {
const { t } = useMovkI18n()
const categories = computed(() => ({
guide: [
{ id: 'basics', title: t('docs.overview'), icon: 'i-lucide-settings' }
]
}))
return {
categories
}
}
Once overridden, docs.categories no longer applies.
Changelog
useHeader
Provides the desktop and mobile header navigation links. Declare them in header.nav and header.mobileNav in app.config; override the composable with a same-named file in your project only when links must be generated from runtime state.
useTheme
The state and actions behind the theme picker - primary color, neutral color, radius, icon set, black as primary and color mode. Visitor choices persist in localStorage and can be exported as app.config or CSS. Use it for a custom theme picker or to switch themes from a page.