Layout Components
Navbar
Main navigation bar with dropdown menus and mobile support
Live Preview
The Navbar is also active at the top of this page. The preview below shows it rendered in isolation.
Installation
// Copy the Navbar component fromsrc/components/layout/Navbar.tsx// Install dependenciesnpm install lucide-react
Usage
import { Navbar } from '@/components/layout/Navbar'export default function RootLayout({ children }) {return (<html><body><Navbar /><main>{children}</main></body></html>)}
State Management
The Navbar component manages three pieces of state for complex interactions:
const [mobileOpen, setMobileOpen] = useState(false) // Mobile menu toggleconst [openDropdown, setOpenDropdown] = useState<string | null>(null) // Desktop dropdownconst [mobileExpanded, setMobileExpanded] = useState<string | null>(null) // Mobile submenu
- โขmobileOpen: Controls the visibility of the mobile menu
- โขopenDropdown: Tracks which desktop dropdown menu is currently open
- โขmobileExpanded: Tracks which mobile submenu is expanded
Prompt Preview
Copy a prompt that recreates this UI
Paste this into your AI coding assistant to generate code that closely matches the reference, including color, size, shape, typography, spacing, and polish.
Copy-ready AI prompt
Starts from the current visual reference and project constraints.
Tweak only product-specific copy or data after the first generation pass.
Props
This component has no props.
This component uses NAV_ITEMS and BRAND_NAME constants from lib/constants.ts
Features
- โSticky positioning
- โDesktop horizontal navigation
- โDropdown menus for nested items
- โClick-outside handler
- โMobile hamburger menu
- โMobile slide-down menu
- โPhone icon button (mobile)
- โComplex state management
- โUses NAV_ITEMS constant
Dependencies
lucide-react