Installation
Usage
Features
- Morphing Borders: Border radius dynamically adjusts based on active link position
- Smart Rounding: Corner rounding logic accounts for adjacent active links
- Glass Effect: Semi-transparent background with blur effect
- Dark Mode Support: Automatically adapts colors for light and dark themes
- State Management: Built-in active state tracking
- Smooth Transitions: CSS transitions for all state changes
Customization
The component uses a predefined set of navigation items. To customize:Styling
The navbar uses the following key styles:- Glass Effect:
.glassclass for semi-transparent background - Active State: Rounded corners and spacing adjustments
- Dark Mode: Inverted colors (black background in light mode, white in dark mode)
- Text: Small font size with smooth color transitions
Border Logic
The component implements intelligent border rounding:- Active link gets fully rounded corners (
rounded-xl) - Link adjacent to active link rounds only the far edge
- First item rounds left edge when first or second item is active
- Last item rounds right edge when last or second-to-last item is active
Example Implementation
Accessibility
- Uses semantic
<nav>element - Proper link structure with Next.js
<Link> - Click handlers update visual state
- Keyboard navigation supported through standard link behavior
Dependencies
clsx(conditional class names)next/linkreact(useState hook)