Logoshadcn-docs-template
DocsDemo
Sections
  • Get Started
Getting Started
  • Introduction
  • Installation
Customization
  • Customizing the Template
  • MDC Components
  • Composables
  • Writing Documentation
Components
  • DocTabs
  • Callout
  • ComponentPreview
  • CommandMenu
  • CopyButton
  • DocsSidebar
  • DocsTableOfContents
  • PageHeader
  • SiteHeader
  • CopyCodeButton
  • DocsCopyPage
  • CodeBlockCommand
  • CommandMenuItem
  • CommandMenuKbd
  • GitHubLink
  • LucideIcon
  • MainNav
  • MobileNav
  • ModeSwitcher
  • PageHeaderDescription
  • PageHeaderHeading
  • SiteBody
  • SiteConfig
  • SiteFooter
  • OgImage (Custom)

MobileNav

PreviousNext

Mobile navigation component with hamburger menu and full-screen overlay.

The MobileNav component provides a mobile-friendly navigation menu with a hamburger button and full-screen overlay.

Usage

<script setup lang="ts">
import { MobileNav } from '@/components/MobileNav'
import type { ContentNavigationItem } from '@nuxt/content'

const tree: ContentNavigationItem[] = [
  {
    title: "Docs",
    children: [
      {
        title: "Getting Started",
        children: [
          {
            title: "Introduction",
            path: "/docs/getting-started/introduction",
          },
        ],
      },
    ],
  },
]

const items = [
  { href: "/docs", name: "Docs" },
]
</script>

<template>
  <MobileNav :tree="tree" :items="items" />
</template>

Features

Hamburger Menu

  • Animated hamburger icon
  • Transforms to X when open
  • Touch-friendly target size

Navigation Sections

Displays three sections:

  1. Main Links: Home and top-level navigation
  2. Sections: Section pills from NAV_SECTIONS
  3. Content Tree: Auto-generated from content structure

Full-Screen Overlay

  • Full viewport height and width
  • Backdrop blur effect
  • Scrollable content
  • Large, touch-friendly links

API Reference

MobileNav

PropTypeDescription
treeContentNavigationItem[]Navigation tree from Nuxt Content
items{ href: string; name: string }[]Main navigation items
classHTMLAttributes["class"]Custom CSS classes

Styling

  • Large text sizes (text-2xl) for readability
  • Generous spacing (gap-12, gap-4, gap-3)
  • Section labels with muted foreground
  • Icon support for navigation items

Configuration

Uses NAV_SECTIONS from app/lib/navigation.ts and respects showMcpDocs flag for filtering.

MainNavModeSwitcher

On This Page

UsageFeaturesHamburger MenuNavigation SectionsFull-Screen OverlayAPI ReferenceMobileNavStylingConfiguration
© shadcn-vue.com