Menu Dock
Versatile dock navigation with responsive variants, dual orientations, and smooth animations. A free open source React component for Next.js with TypeScript support and shadcn/ui design token integration.
Installation
npx shadcn@latest add https://www.shadcn.io/registry/menu-dock.json
npx shadcn@latest add https://www.shadcn.io/registry/menu-dock.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/menu-dock.json
bunx shadcn@latest add https://www.shadcn.io/registry/menu-dock.json
Features
- Free open source React component built for Next.js applications with professional dock navigation functionality
- Multiple responsive variants including compact, default, and large sizes for optimal screen adaptation
- TypeScript-first development with comprehensive type definitions and IntelliSense support
- Dual orientation support with horizontal and vertical layouts for flexible interface positioning
- Tailwind CSS integration for seamless styling, theming, and responsive design patterns
- shadcn/ui design tokens providing consistent theming and component integration
- Smart dynamic underlines that automatically adjust to text width in horizontal layouts using JavaScript
- Smooth bounce animations for active states with configurable animation controls
- Flexible configuration options including label visibility, animation toggles, and orientation switching
- Desktop-optimized large variant specifically designed for big screen displays and professional interfaces
- Complete accessibility support with keyboard navigation, ARIA labels, and screen reader compatibility
- Built-in validation system ensuring proper configuration with automatic fallbacks and development warnings
Usage
import { MenuDock, type MenuDockItem } from '@/components/ui/menu-dock';
import { Home, User, Settings } from 'lucide-react';
// Basic usage with default items
<MenuDock />
// Custom menu items with click handlers
const menuItems: MenuDockItem[] = [
{ label: 'home', icon: Home, onClick: () => console.log('Home') },
{ label: 'profile', icon: User, onClick: () => console.log('Profile') },
{ label: 'settings', icon: Settings, onClick: () => console.log('Settings') },
];
// Responsive menu with different variants
<MenuDock
items={menuItems}
variant="default"
className="lg:hidden"
/>
<MenuDock
items={menuItems}
variant="large"
className="hidden lg:flex"
/>
// Vertical compact menu
<MenuDock
items={menuItems}
variant="compact"
orientation="vertical"
/>
// Icons only (no labels)
<MenuDock
items={menuItems}
showLabels={false}
/>
Examples
Custom Items (Large Variant)
Responsive Menu
Vertical Layout
Icons Only
Props
MenuDock
Prop | Type | Default | Description |
---|---|---|---|
items | InteractiveMenuItem[] | defaultItems | Array of menu items (2-8 items) |
className | string | - | Additional CSS classes |
variant | 'default' | 'compact' | 'large' | 'default' | Size variant of the menu |
orientation | 'horizontal' | 'vertical' | 'horizontal' | Layout orientation |
showLabels | boolean | true | Whether to show text labels |
animated | boolean | true | Enable/disable animations |
MenuDockItem Interface
Property | Type | Description |
---|---|---|
label | string | Display text for the menu item |
icon | React.ElementType<{ className?: string }> | Icon component (e.g., Lucide icons) |
onClick | () => void | Optional click handler |
Variants
Size Variants
- Compact:
p-1
, smaller icons (16px), minimal spacing - ideal for sidebars - Default:
p-4
, medium icons (20px), balanced spacing - general use - Large:
p-6
, larger icons (28px), generous spacing - big screens and desktop
Orientation Options
- Horizontal: Traditional navbar-style layout with optional underlines
- Vertical: Sidebar-style layout with position indicators
Responsive Design
// Responsive pattern for different screen sizes
<MenuDock variant="compact" className="md:hidden" />
<MenuDock variant="default" className="hidden md:flex lg:hidden" />
<MenuDock variant="large" className="hidden lg:flex" />
Animation Details
- Icon Bounce: Smooth bounce animation for active states using CSS keyframes
- Dynamic Underlines: Smart positioning that adjusts to text width (horizontal mode)
- Position Indicators: Animated indicators for vertical layouts and icon-only modes
- Smooth Transitions: 200-300ms duration for all state changes
- Responsive Animations: Automatically adapt to screen size and orientation changes
Styling
The component uses shadcn/ui design tokens:
bg-card
- Background colorborder
- Border stylingtext-primary
- Active text colortext-muted-foreground
- Inactive text colorhover:bg-muted/50
- Hover statesfocus-visible:ring-2
- Focus indicators
Use Cases
This free open source React component is perfect for:
- Next.js dashboards - Create responsive navigation with TypeScript safety and multiple size variants
- Mobile-first applications - Build adaptive navigation that scales beautifully using shadcn/ui design patterns
- Admin interfaces - Implement professional dock navigation with smooth animations and JavaScript interactions
- Portfolio websites - Design unique navigation experiences with dual orientations using Tailwind CSS styling
- SaaS platforms - Create memorable user interfaces with configurable layouts and open source flexibility
- E-commerce sites - Guide users through product categories with elegant animated navigation
- Design systems - Integrate versatile dock components into existing component libraries
Technical Details
Responsive Variant System
The component adapts automatically to different screen requirements:
- Compact variant: Optimized for mobile and sidebar use with minimal spacing and 16px icons
- Default variant: Balanced design for general use with medium spacing and 20px icons
- Large variant: Desktop-optimized with generous spacing and 28px icons for professional interfaces
Smart Animation System
- Dynamic underline positioning with real-time text width calculation using DOM measurements
- Bounce animations for active states with CSS keyframes and configurable timing
- Position indicators for vertical layouts with smooth transitions and responsive positioning
- Resize-responsive animations that adapt to screen changes and orientation shifts
Performance Optimizations
- Efficient DOM measurements with optimized resize handling and minimal recalculations
- TypeScript-optimized component structure with proper prop validation and type safety
- Tailwind CSS classes for consistent theming without runtime style computation
- Smart re-rendering with React refs and memoized calculations for optimal performance
Accessibility
This open source component includes comprehensive accessibility features:
- Complete keyboard navigation with proper tab order management and focus indicators
- ARIA label implementation with semantic navigation structure for assistive technologies
- React-compatible interaction when used in interactive Next.js applications
- High contrast support with customizable theming using shadcn/ui design tokens
- Screen reader friendly with descriptive labels and accessible component architecture
Validation
The component includes built-in validation:
- Items array must contain 2-8 items
- Invalid configurations fall back to default items
- Console warnings for development debugging
- Automatic fallback to safe defaults
macOS Dock
Pixel-perfect macOS dock replica with authentic magnification physics and responsive design. A free open source React component for Next.js featuring TypeScript integration and Tailwind CSS compatibility.
Message Dock
Interactive messaging interface with character avatars and smooth expanding animations. A free open source React component for Next.js featuring TypeScript integration and Framer Motion physics.