Updated
Typing Dots
NewCustomize
Typing duration1.4s
Gap0.5s
Hold2.4s
Max width260px
Radius20px
Installation
npx shadcn@latest add https://uibrik.com/r/typing-dots.jsonInstall the packages
npm install motion react-use-measureAdd the cn helper
Imports
cnfrom@/lib/utils, whichshadcn initcreates. Add it by hand without shadcn.Copy the source into your project
components/uibrik/typing-dots/typing-dots.tsx"use client"; import { AnimatePresence, motion, useAnimationControls, useReducedMotion } from "motion/react"; import { useEffect, useState } from "react"; import useMeasure from "react-use-measure"; import { cn } from "@/lib/utils"; const EASE_OUT: [number, number, number, number] = [0.23, 1, 0.32, 1]; // The bubble while typing: three dots with even padding around them. const DOTS_W = 58; const DOTS_H = 38; export type TypingDotsProps = { /** Messages that arrive one after another, each typed out first. */ messages?: string[]; /** Seconds the dots show before each message lands. */ typingDuration?: number; /** Seconds between one message landing and the next one starting to type. */ gap?: number; /** Start over once every message has landed. */ loop?: boolean; /** Seconds the finished thread stays before it starts over. */ holdDuration?: number;
Adds the files to
components/uibrik/typing-dots and installs motion and react-use-measure. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/typing-dots.Usage
import { TypingDots } from "@/components/uibrik/typing-dots/typing-dots";const messages = ["Hey! Just landed.", "Grabbing a coffee, then I'll head your way.", "Twenty minutes?"];<TypingDots messages={messages} typingDuration={1.4} gap={0.5} loop holdDuration={2.4} maxWidth={260} radius={20}/>Where to use Typing Dots
Chat and messaging
The dots become the message in place, so the thread never jumps when a reply arrives.
Pairs with Read Receipts
AI assistants
A short typing beat before each answer makes a bot's replies feel paced rather than dumped.
Pairs with Streaming Chat and Prompt Input
Onboarding conversations
Messages that arrive one at a time walk a new user through setup at reading speed.
Props
TypingDots- messages
- Type string[]
- ["Hey! Just landed.","Grabbing a coffee, then I'll head your way.","Twenty minutes?"]
- Messages that arrive one after another.
- typingDuration
- Type number
- 1.4
- How long the dots show before each message.
- gap
- Type number
- 0.5
- Pause between one message and the next starting to type.
- loop
- Type boolean
- true
- Start over once every message has landed.
- holdDuration
- Type number
- 2.4
- How long the finished thread stays before starting over.
- maxWidth
- Type number
- 260
- Widest a bubble grows before its text wraps.
- radius
- Type number
- 20
- Corner radius of the bubbles.
- className
- Type string
- –
- Classes for the thread.