Components / Feedback
Loaders
Five loading animations: dots, spinner, bars, pulse and orbit. Colored by text color.
dots
spinner
bars
pulse
orbit
Installation
Requires React 18+ and Tailwind CSS.
- 1
Install dependencies
$ npm install motion - 2
Add the component
Copy the code from the Code tab above into
components/ui/loaders.tsx. - 3
Use it
example.tsximport { Loader } from "@/components/ui/loaders"; const variants = ["dots", "spinner", "bars", "pulse", "orbit"] as const; export default function LoadersDemo() { return ( <div className="grid grid-cols-3 gap-8 sm:grid-cols-5"> {variants.map((variant, i) => ( <div key={variant} className="flex flex-col items-center gap-3"> <div className="grid h-8 place-items-center"> <Loader variant={variant} className={i % 2 ? "text-orange-500" : undefined} /> </div> <span className="text-xs text-zinc-500">{variant}</span> </div> ))} </div> ); }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "dots" | "spinner" | "bars" | "pulse" | "orbit" | "dots" | Which animation. |
| className | string | — | Color and size, e.g. "text-orange-500". |
| label | string | "Loading" | Accessible label. |