Install one of 238 ready loaders, see what its file holds, and change its color, size, dots or pattern.
Engine · 2 min read
An example is a ready loader: one built-in pattern on one layout, with a dot shape and a theme color. There are 238 of them, every pattern on every layout. Browse them on the examples page.
Install an example
Each example is its own registry item. The name is the pattern in kebab-case, a dash, and the layout:
npx shadcn@latest add https://dotsengine.dev/r/radar-circle.json
npx shadcn@latest add https://dotsengine.dev/r/progress-ring-bar.json| Pattern | Layout | Item name | Component |
|---|---|---|---|
radar | circle | radar-circle | RadarCircle |
progressRing | bar | progress-ring-bar | ProgressRingBar |
check | hex | check-hex | CheckHex |
The command installs the engine too, if your project does not have it yet.
What the file holds
The example installs one file, components/ui/<item>/<item>.tsx. It is a small component over DotMatrix. This is radar-circle, without its comment:
"use client";
import type { ComponentProps } from "react";
import { DotMatrix } from "../dot-matrix/dot-matrix";
type RadarCircleProps = Omit<ComponentProps<typeof DotMatrix>, "pattern" | "lattice">;
export function RadarCircle({ look, ...props }: RadarCircleProps) {
return (
<DotMatrix
pattern="radar"
lattice="circle"
color="var(--chart-4)"
look={{ dot: "round", ...look }}
{...props}
/>
);
}The dot shape and the chart color differ for each example. A progress example also sets a value, so it shows work in progress.
Use it
import { RadarCircle } from "@/components/ui/radar-circle/radar-circle";
<RadarCircle size={24} aria-label="Searching" />;Change it
The example takes every prop of DotMatrix except pattern and lattice. Your props win over its defaults.
| To change | Pass |
|---|---|
| The color | color="var(--chart-3)" or className="text-sky-500" with color={undefined} |
| The size | size={32} |
| The dot shape | look={{ dot: "square" }} |
| The speed | look={{ speed: 1.5 }} |
| The progress | value={0.4} |
To change the pattern or the layout, edit the file. It is your code now. Or install another example.
Theme colors
The examples use the chart colors --chart-1 to --chart-5. Every shadcn theme defines them. So an example takes your theme's colors in light and dark mode, with no work. See Colors.