Classic loader
Typing indicator
Three dots gently swell and fade in a familiar typing rhythm. A single React component with its CSS built in and no dependencies. Install it with the shadcn CLI or copy the source.
Preview and installation
Run this command in any project set up with shadcn.
npx shadcn@latest add https://loadercn.vercel.app/r/classic-typing.jsonAdded the @loadercn registry? Use the short form:
npx shadcn@latest add @loadercn/classic-typingThen add it to your interface:
import { ClassicTyping } from "@/components/ui/classic-typing"
<ClassicTyping size={48} speed={1.6} />Inherits text color. Accepts className, style, and a custom loading label. Respects reduced-motion preferences.
import type { CSSProperties, ComponentProps } from "react"
export type ClassicTypingProps = ComponentProps<"span"> & {
size?: number
/** Duration of one complete cycle, in seconds. */
speed?: number
label?: string
}
export function ClassicTyping({
size = 40,
speed = 1.6,
label = "Loading",
className,
style,
...props
}: ClassicTypingProps) {
return (
<span
role="status"
aria-label={label}
{...props}
className={["classic-typing-loader", className].filter(Boolean).join(" ")}
style={
{
width: size,
height: size,
"--loader-size": `${size}px`,
"--loader-duration": `${Math.max(0.1, speed)}s`,
...style,
} as CSSProperties
}
>
<span aria-hidden="true" className="classic-typing-loader-body">
{[0, 1, 2].map((i) => (
<span
key={i}
className="classic-typing-loader-dot"
style={{
left: `${i * 36}%`,
animationDelay: `${(i / 6 - 1) * Math.max(0.1, speed)}s`,
}}
/>
))}
</span>
<style>{`
.classic-typing-loader { display: inline-flex; flex-shrink: 0; }
.classic-typing-loader-body { position: relative; width: 100%; height: 100%; }
.classic-typing-loader-dot { position: absolute; top: 42%; width: 22%; height: 22%; border-radius: 50%; background: currentColor; animation: classic-typing-loader-pulse var(--loader-duration) ease-in-out infinite; }
@keyframes classic-typing-loader-pulse { 0%, 70%, 100% { transform: scale(.7); opacity: .3; } 35% { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .classic-typing-loader-body, .classic-typing-loader-body * { animation: none !important; } }
`}</style>
</span>
)
}
Copy the complete file into your components directory. Styles are included.
When to use it
Use it exactly where people expect it: when someone, or an AI assistant, is composing a reply.
Props
Typing indicator accepts size, speed, label, className, and style, like every loader in the collection. See the installation guide for the full reference.