Basic Usage
Static Links
Full Example
Usage in Gaia
A polished navigation experience. Smooth animations, flexible layouts, and support for both dropdown menus and direct links.Installation
Usage
Examples
With Background Images
Links can include background images for a more visual experience:Custom Grid Layouts
Customize the grid layout for each section:Mixed Navigation Items
Combine dropdown menus with direct links:Custom Logo and CTA
Span Multiple Rows
Make important links take up more space:Features
- Smooth Animations: Uses Framer Motion for fluid dropdown animations
- Flexible Layouts: Customizable grid layouts for menu sections
- Mixed Navigation: Support for both dropdown menus and direct links
- Background Images: Rich visual links with optional background images
- Icon Support: Add icons to menu items for better visual hierarchy
- Keyboard Navigation: Full keyboard accessibility with arrow keys
- Hover States: Polished hover effects with background highlights
- External Links: Automatic handling of external links with proper attributes
- Theme Support: Automatic dark/light mode theme detection
- Responsive: Adapts to different screen sizes
Props
NavbarWithMenu
| Prop | Type | Default | Description |
|---|---|---|---|
| sections | NavbarMenuSection[] | - | Array of menu sections |
| navItems | NavItem[] | - | Navigation items (links or dropdowns) |
| logo | React.ReactNode | - | Custom logo component |
| cta | React.ReactNode | - | Call-to-action button |
NavbarMenuSection
| Property | Type | Default | Description |
|---|---|---|---|
| id | string | - | Unique identifier for section |
| links | NavbarMenuLink[] | - | Array of links in this section |
| gridLayout | string | ”grid w-full grid-cols-2 gap-4” | CSS classes for grid layout |
NavbarMenuLink
| Property | Type | Default | Description |
|---|---|---|---|
| label | string | - | Link text |
| href | string | - | Link URL |
| icon | React.ReactNode | - | Icon component to display |
| external | boolean | false | Whether link opens in new tab |
| description | string | - | Subtitle text under the label |
| backgroundImage | string | - | URL to background image |
| rowSpan | number | 1 | Number of grid rows to span |
NavItem
Can be either a link or dropdown: Link:Accessibility
- Keyboard Navigation: Use arrow keys to navigate between menu items
- Enter/Space: Activate menu items
- Escape: Close open menus
- Focus Management: Proper focus indicators and tab order
- ARIA Labels: Menu buttons have proper
aria-expandedattributes - Screen Reader Support: Semantic HTML and proper roles
Notes
- The component automatically detects the theme (light/dark) and adjusts the logo if using default logo paths
- Menu items are grouped in a hover container, so the menu stays open when moving between items
- Background images use Next.js Image component for optimization
- The component uses CSS variables for theming, ensuring consistency across your app