Classic loader
Dot stream
Five dots flow across a line, growing at the center and fading at the edges. 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-dot-stream.jsonAdded the @loadercn registry? Use the short form:
npx shadcn@latest add @loadercn/classic-dot-streamThen add it to your interface:
import { ClassicDotStream } from "@/components/ui/classic-dot-stream"
<ClassicDotStream 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 ClassicDotStreamProps = ComponentProps<"span"> & {
size?: number
/** Duration of one complete cycle, in seconds. */
speed?: number
label?: string
}
export function ClassicDotStream({
size = 40,
speed = 1.6,
label = "Loading",
className,
style,
...props
}: ClassicDotStreamProps) {
return (
<span
role="status"
aria-label={label}
{...props}
className={["classic-dot-stream-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-dot-stream-loader-track">
{[0, 1, 2, 3, 4].map((i) => (
<span
key={i}
style={
{
"--rest-x": `${14 + i * 18}%`,
animationDelay: `${(-i / 5) * Math.max(0.1, speed)}s`,
} as CSSProperties
}
/>
))}
</span>
<style>{`
.classic-dot-stream-loader { display: inline-flex; flex-shrink: 0; }
.classic-dot-stream-loader-track { position: relative; width: 100%; height: 100%; }
.classic-dot-stream-loader-track > span { position: absolute; top: 50%; left: var(--rest-x); width: 16%; height: 16%; border-radius: 50%; background: currentColor; transform: translate(-50%, -50%); animation: classic-dot-stream-loader-flow var(--loader-duration) linear infinite; }
@keyframes classic-dot-stream-loader-flow { 0% { left: 8%; transform: translate(-50%, -50%) scale(0); opacity: 0; } 50% { left: 50%; transform: translate(-50%, -50%) scale(1); opacity: 1; } 100% { left: 92%; transform: translate(-50%, -50%) scale(0); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .classic-dot-stream-loader-track > span { animation: none; opacity: .7; } }
`}</style>
</span>
)
}
Copy the complete file into your components directory. Styles are included.
When to use it
A horizontal loader for inline and wide spaces. Use it inside text, under headings, or in narrow toolbars.
Props
Dot stream accepts size, speed, label, className, and style, like every loader in the collection. See the installation guide for the full reference.