Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Guidance for building UIs with Nuxt UI, the official Tailwind-based component library for Nuxt.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/recipes/navigation.md
1# Navigation23Patterns for headers, sidebars, breadcrumbs, and tab navigation.45## Header with mobile menu67`UHeader` default slot is desktop nav, `#body` is the mobile menu. Without `#body`, mobile users have no navigation.89```vue10<UHeader>11<template #title>12<Logo class="h-6 w-auto" />13</template>1415<UNavigationMenu :items="items" />1617<template #right>18<UColorModeButton />19<UButton label="Sign in" color="neutral" variant="ghost" />20</template>2122<template #body>23<UNavigationMenu :items="items" orientation="vertical" class="-mx-2.5" />24</template>25</UHeader>26```2728> Full app shell example in [landing layout](../layouts/landing.md).2930## Sidebar navigation (dashboard)3132See [dashboard layout](../layouts/dashboard.md) for the full sidebar pattern with `UDashboardSidebar` + `UNavigationMenu`. Key points:33- Pass `:collapsed="collapsed"` to `UNavigationMenu` inside collapsible sidebars34- Use `NavigationMenuItem[][]` (nested arrays) for separate nav groups35- Use `#footer` slot for user menu with `UDropdownMenu`3637## Breadcrumbs3839```vue40<script setup lang="ts">41const route = useRoute()4243const breadcrumbs = computed(() => {44const segments = route.path.split('/').filter(Boolean)45return segments.map((segment, index) => ({46label: segment.charAt(0).toUpperCase() + segment.slice(1),47to: '/' + segments.slice(0, index + 1).join('/')48}))49})50</script>5152<template>53<UBreadcrumb :items="breadcrumbs" />54</template>55```5657## Tab navigation (within a page)5859```vue60<script setup lang="ts">61const items = [{62label: 'Overview',63icon: 'i-lucide-layout-dashboard',64slot: 'overview' as const65}, {66label: 'Activity',67icon: 'i-lucide-activity',68slot: 'activity' as const69}, {70label: 'Members',71icon: 'i-lucide-users',72slot: 'members' as const73}]74</script>7576<template>77<UTabs :items="items">78<template #overview>79<!-- Overview content -->80</template>81<template #activity>82<!-- Activity feed -->83</template>84<template #members>85<!-- Members list -->86</template>87</UTabs>88</template>89```9091