TypingIndicator component displays an animated three-dot indicator to show when a contact is typing a message. It uses CSS animations for smooth, staggered bouncing effects.
Location
components/chat/typing-indicator.tsx
Props
Accessible label for screen readers
Features
Animated bouncing dots
The component renders three dots that bounce in sequence with staggered timing:components/chat/typing-indicator.tsx
- Dot 0: 0s delay
- Dot 1: 0.12s delay
- Dot 2: 0.24s delay
Accessibility
The component includes proper ARIA attributes for screen readers:components/chat/typing-indicator.tsx
aria-live="polite": Announces changes to screen readers without interruptingaria-label: Provides context about what the indicator means.sr-only: Hidden text label for screen readers
Memoization
The component is wrapped inReact.memo to prevent unnecessary re-renders:
components/chat/typing-indicator.tsx
Usage
Styling
The indicator uses these Tailwind classes for styling:bg-black/5: Semi-transparent backgroundrounded-full: Fully rounded pill shapepx-3 py-1: Comfortable paddingtext-xs font-medium: Small, medium-weight texttext-muted-foreground: Subtle text colorbg-accent: Dots use the primary accent color
Animation timing
The animation creates a smooth wave effect:- Each dot uses Tailwind’s
animate-bounceutility - Custom
animationDelaystaggers the start time - Total cycle: ~0.36s for all three dots to complete one bounce sequence
Related components
- MessageList - Renders the typing indicator as a footer
- ChatPanel - Manages typing state via the store