Loader made of a grid of cells that light up one after another. The wave starts in the center or in any corner, the grid size is configurable, and the color comes from currentColor, so a text-* class is enough to recolor it.
Preview
Loading
Installation
Usage
import { RippleLoader } from "@/components/ui/ripple-loader"
export default function Example() {
return <RippleLoader size={96} gap={4} />
}Examples
Wave origin
origin picks where the wave starts. From the center it spreads in rings, from a corner it runs along the diagonal.
Loading
centerLoading
top-leftLoading
top-rightLoading
bottom-leftLoading
bottom-right<RippleLoader origin="center" />
<RippleLoader origin="top-left" />
<RippleLoader origin="bottom-right" />Grid, shape and color
grid sets the cells per side, shape the cell form. The color is inherited from the text, so use any text-* class.
Loading
Loading
Loading
<RippleLoader grid={3} size={56} shape="square" gap={0} />
<RippleLoader grid={4} size={64} shape="circle" origin="top-left" className="text-foreground" />
<RippleLoader grid={5} size={72} gap={3} duration={2000} className="text-muted-foreground" />Inside a button
At 16 px it fits next to a button label.
<Button disabled={saving}>
{saving && (
<RippleLoader size={16} gap={1} className="text-primary-foreground" label="Saving" />
)}
{saving ? "Saving" : "Save"}
</Button>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| size | number | 48 | Width and height of the grid in px |
| grid | number | 3 | Cells per side |
| origin | "center" | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "center" | Where the wave starts |
| duration | number | 1500 | One wave cycle, ms |
| gap | number | 2 | Gap between cells in px |
| shape | "square" | "rounded" | "circle" | "rounded" | Cell shape |
| label | string | "Loading" | Text for screen readers |
| className | string | - | Additional CSS classes, text-* sets the color |
Features
- Pure CSS: one keyframe and per-cell delays, no JavaScript timers
- currentColor: inherits the text color and fits any theme
- Accessible: role="status" with a visually hidden label
- Reduced motion: the wave stops and the grid shows a static gradient instead