Documentation
Documentation

Navigation Guide

Learn how to implement responsive navigation in your Next.js application using our pre-built components and best practices.

Implementation

Our navigation system consists of two main components: Header and Navbar. The Header component provides the container and layout, while the Navbar handles the navigation links and mobile menu.

Header Component

components/header.tsxtsx
1export default function Header(){
2 return (
3 <header className="sticky top-0 z-50 bg-white/80 backdrop-blur-sm border-b border-gray-200">
4 <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 h-full">
5 <div className="flex items-center justify-between h-full">
6 <h1 className="text-2xl font-bold">Company Name</h1>
7 <Navbar />
8 </div>
9 </div>
10 </header>
11 )
12}

Navbar Component

components/navbar.tsxtsx
1"use client"
2
3import { useState } from "react"
4import Link from "next/link"
5import { Menu, X } from 'lucide-react'
6
7export default function Navbar() {
8 const [isOpen, setIsOpen] = useState(false)
9
10 return (
11 <div className="">
12 <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
13 <div className="flex items-center justify-end h-16">
14 <nav className="hidden md:flex items-center gap-8">
15 <Link href="#features" className="text-sm font-medium text-gray-600 hover:text-gray-900 transition-colors">
16 Features
17 </Link>
18 <Link href="#testimonials" className="text-sm font-medium text-gray-600 hover:text-gray-900 transition-colors">
19 Testimonials
20 </Link>
21 <Link href="#pricing" className="text-sm font-medium text-gray-600 hover:text-gray-900 transition-colors">
22 Pricing
23 </Link>
24 <Link href="#contact" className="text-sm font-medium text-gray-600 hover:text-gray-900 transition-colors">
25 Contact
26 </Link>
27 </nav>
28
29 <button
30 className="md:hidden p-2 text-gray-600 hover:text-gray-900"
31 onClick={() => setIsOpen(!isOpen)}
32 aria-label="Toggle menu"
33 >
34 {isOpen ? <X /> : <Menu />}
35 </button>
36 </div>
37 </div>
38
39 {isOpen && (
40 <div className="md:hidden">
41 <nav className="px-4 pt-2 pb-4 space-y-1 bg-white border-b border-gray-200">
42 <Link
43 href="#features"
44 className="block px-3 py-2 text-base font-medium text-gray-600 hover:text-gray-900 hover:bg-gray-50 rounded-lg transition-colors"
45 onClick={() => setIsOpen(false)}
46 >
47 Features
48 </Link>
49 <Link
50 href="#testimonials"
51 className="block px-3 py-2 text-base font-medium text-gray-600 hover:text-gray-900 hover:bg-gray-50 rounded-lg transition-colors"
52 onClick={() => setIsOpen(false)}
53 >
54 Testimonials
55 </Link>
56 <Link
57 href="#pricing"
58 className="block px-3 py-2 text-base font-medium text-gray-600 hover:text-gray-900 hover:bg-gray-50 rounded-lg transition-colors"
59 onClick={() => setIsOpen(false)}
60 >
61 Pricing
62 </Link>
63 <Link
64 href="#contact"
65 className="block px-3 py-2 text-base font-medium text-gray-600 hover:text-gray-900 hover:bg-gray-50 rounded-lg transition-colors"
66 onClick={() => setIsOpen(false)}
67 >
68 Contact
69 </Link>
70 </nav>
71 </div>
72 )}
73 </div>
74 )
75}

Navbar Variants

We provide several pre-built navbar variants that you can use in your application. Each variant is customizable and responsive out of the box.

Default Navbar

A simple navbar with a logo and navigation links.

Sticky Navbar

A navbar that sticks to the top of the viewport when scrolling.

Centered Navbar

A navbar with centered navigation links.

Mobile Navigation

Our navigation components are fully responsive and provide an excellent mobile experience. Here are some examples of mobile navigation patterns:

Hamburger Menu

Classic hamburger menu that slides in from the side.

Logo

Bottom Navigation

Fixed bottom navigation bar for mobile devices.

Fullscreen Menu

Full-screen overlay navigation menu.

Logo

Dropdown Menu

Dropdown menu that expands below the header.

Logo

Best Practices

  • Accessibility: Ensure your navigation is keyboard accessible and includes proper ARIA labels. All interactive elements should have visible focus states.
  • Performance: Use client-side components only when necessary. The basic navigation structure can be server-rendered for better performance.
  • Mobile First: Design your navigation with mobile devices in mind first, then enhance for larger screens.
  • Visual Hierarchy: Use consistent spacing, typography, and color to establish clear visual hierarchy in your navigation.
  • State Management: Handle active states, hover states, and focus states consistently across all navigation items.