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)

MainNav

PreviousNext

Desktop navigation component that displays navigation items horizontally.

The MainNav component provides horizontal desktop navigation.

Usage

<script setup lang="ts">
import { MainNav } from '@/components/MainNav'

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

<template>
  <MainNav :items="items" />
</template>

Features

  • Horizontal layout for desktop
  • Active state highlighting
  • Hover effects
  • Responsive (hidden on mobile)

API Reference

MainNav

PropTypeDescription
items{ href: string; name: string }[]Navigation items array
classHTMLAttributes["class"]Custom CSS classes

Styling

  • Active link uses text-primary
  • Inactive links use text-muted-foreground
  • Hover effect with hover:text-primary
  • Ghost button variant

Configuration

Typically uses MAIN_NAVIGATION from app/lib/navigation.ts:

export const MAIN_NAVIGATION = [
  { href: "/docs", name: "Docs" },
]
LucideIconMobileNav

On This Page

UsageFeaturesAPI ReferenceMainNavStylingConfiguration
© shadcn-vue.com