Join our Discord community
Dock

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

Loading component...

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

PropTypeDefaultDescription
charactersCharacter[]defaultCharactersArray 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
classNamestring-Additional CSS classes
expandedWidthnumber448Width when expanded (px)
position"bottom" | "top""bottom"Dock position on screen
showSparkleButtonbooleantrueShow sparkle button on left
showMenuButtonbooleantrueShow menu/send button on right
enableAnimationsbooleantrueEnable/disable animations
animationDurationnumber1Animation duration multiplier
placeholder(name) => string"Message {name}..."Input placeholder function
theme"light" | "dark" | "auto""light"Color theme
autoFocusbooleantrueAuto-focus input when expanded
closeOnClickOutsidebooleantrueClose dock when clicking outside
closeOnEscapebooleantrueClose dock on Escape key
closeOnSendbooleantrueClose dock after sending message

Character Interface

PropertyTypeDescription
idstring | numberOptional unique identifier
emojistringCharacter emoji/icon
namestringCharacter display name
onlinebooleanOnline status (shows green dot)
backgroundColorstringTailwind background class
gradientColorsstringCSS gradient colors for expanded state
avatarstringOptional 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:

  1. Spring physics calculations: Natural feeling animations with configurable stiffness, damping, and mass properties
  2. Stagger effect sequencing: Characters animate in precise timing sequences for visual appeal
  3. Smooth gradient morphing: Dynamic background transitions with CSS-in-JS color interpolation
  4. 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