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.
Powered by
Installation
npx shadcn@latest add https://www.shadcn.io/registry/message-dock.json
npx shadcn@latest add https://www.shadcn.io/registry/message-dock.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/message-dock.json
bunx shadcn@latest add https://www.shadcn.io/registry/message-dock.json
Features
- Free open source React component built for Next.js applications with interactive messaging functionality
- Character-based messaging system featuring customizable avatars, emojis, and real-time status indicators
- TypeScript-first development with comprehensive type definitions and IntelliSense support
- Advanced Framer Motion animations with spring physics, stagger effects, and smooth expand/collapse transitions
- Tailwind CSS integration for seamless styling, gradient backgrounds, and responsive design patterns
- shadcn/ui compatibility following modern component architecture and design system conventions
- Dynamic theme support with light, dark, and auto modes featuring customizable gradient color schemes
- Complete keyboard navigation with Enter to send, Escape to close, and full accessibility compliance
- Intelligent interaction patterns including click outside to close and configurable auto-focus behavior
- Responsive adaptive design that works beautifully across all device sizes and orientations
- Performance optimized with reduced motion support, hardware acceleration, and efficient rendering
- Customizable configuration with extensive props for behavior, appearance, and animation control
Usage
import { MessageDock, type Character } from '@/components/ui/message-dock';
const characters: Character[] = [
{ emoji: "✨", name: "Sparkle", online: false },
{
emoji: "🧙♂️",
name: "Wizard",
online: true,
backgroundColor: "bg-green-300",
gradientColors: "#86efac, #dcfce7",
},
// ... more characters
];
<MessageDock
characters={characters}
onMessageSend={(message, character, index) => {
console.log('Message:', message, 'to', character.name);
}}
onCharacterSelect={(character) => {
console.log('Selected:', character.name);
}}
expandedWidth={500}
placeholder={(name) => `Send a message to ${name}...`}
theme="light"
/>
Props
MessageDock
Prop | Type | Default | Description |
---|---|---|---|
characters | Character[] | defaultCharacters | Array of character objects |
onMessageSend | (message, character, index) => void | - | Callback when message is sent |
onCharacterSelect | (character, index) => void | - | Callback when character is selected |
onDockToggle | (isExpanded) => void | - | Callback when dock expands/collapses |
className | string | - | Additional CSS classes |
expandedWidth | number | 448 | Width when expanded (px) |
position | "bottom" | "top" | "bottom" | Dock position on screen |
showSparkleButton | boolean | true | Show sparkle button on left |
showMenuButton | boolean | true | Show menu/send button on right |
enableAnimations | boolean | true | Enable/disable animations |
animationDuration | number | 1 | Animation duration multiplier |
placeholder | (name) => string | "Message {name}..." | Input placeholder function |
theme | "light" | "dark" | "auto" | "light" | Color theme |
autoFocus | boolean | true | Auto-focus input when expanded |
closeOnClickOutside | boolean | true | Close dock when clicking outside |
closeOnEscape | boolean | true | Close dock on Escape key |
closeOnSend | boolean | true | Close dock after sending message |
Character Interface
Property | Type | Description |
---|---|---|
id | string | number | Optional unique identifier |
emoji | string | Character emoji/icon |
name | string | Character display name |
online | boolean | Online status (shows green dot) |
backgroundColor | string | Tailwind background class |
gradientColors | string | CSS gradient colors for expanded state |
avatar | string | Optional image URL (future feature) |
Use Cases
This free open source React component is perfect for:
- Next.js chat applications - Create engaging messaging interfaces with TypeScript safety and character selection
- Customer support platforms - Build interactive help systems with animated character avatars using shadcn/ui patterns
- Gaming interfaces - Design character communication systems with smooth animations and JavaScript interactions
- Creative portfolios - Showcase interactive design work with unique messaging experiences using Tailwind CSS styling
- SaaS applications - Implement memorable user interfaces with character-based navigation and open source flexibility
- Educational platforms - Create engaging learning experiences with animated character guides and messaging
- Social applications - Design innovative communication interfaces with gradient themes and responsive behavior
Technical Details
Advanced Animation System
The component features sophisticated Framer Motion integration:
- Spring physics calculations: Natural feeling animations with configurable stiffness, damping, and mass properties
- Stagger effect sequencing: Characters animate in precise timing sequences for visual appeal
- Smooth gradient morphing: Dynamic background transitions with CSS-in-JS color interpolation
- Reduced motion compliance: Automatic detection and respect for user accessibility preferences
Performance Optimizations
- Hardware-accelerated transforms with GPU optimization for smooth 60fps animations
- 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 AnimatePresence for optimal performance
Interactive Features
- Dynamic width calculations with automatic collapsed/expanded state management
- Real-time status indicators with online/offline character state visualization
- Keyboard event handling with comprehensive key binding support
- Click outside detection with configurable behavior and proper cleanup
Accessibility
This open source component includes comprehensive accessibility features:
- Complete ARIA implementation with proper labels, roles, and semantic markup for assistive technologies
- Keyboard navigation support with tab order management, focus indicators, and custom key bindings
- React-compatible accessibility when used in interactive Next.js applications
- Reduced motion support that automatically adapts animations based on user preferences
- High contrast compatibility with customizable theming and color scheme adaptation
- Screen reader friendly with descriptive labels and accessible component architecture
Animation Features
- Reduced Motion Support: Respects user's motion preferences
- Spring Physics: Natural feeling animations using Framer Motion
- Stagger Effects: Characters animate in sequence
- Smooth Transitions: Seamless expand/collapse with gradient morphing
- Performance Optimized: Uses hardware acceleration and efficient rendering
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.
Credit Card
Interactive credit card display components for React and Next.js applications. Built with TypeScript support, Tailwind CSS styling, and shadcn/ui design for professional payment interfaces with flip animations and security features.