Components / Feedback
Circular Progress
A gradient progress ring that springs to its value, with a counting percentage.
0%
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/circular-progress.tsx. - 3
Use it
example.tsx"use client"; import { useState } from "react"; import { CircularProgress } from "@/components/ui/circular-progress"; export default function CircularProgressDemo() { const [value, setValue] = useState(68); return ( <div className="flex flex-col items-center gap-5"> <CircularProgress value={value} /> <div className="flex gap-2"> {[0, 25, 68, 100].map((v) => ( <button key={v} type="button" onClick={() => setValue(v)} className="rounded-lg border border-zinc-200 bg-white px-3 py-1.5 text-sm tabular-nums text-zinc-700 transition hover:bg-zinc-100 dark:border-white/10 dark:bg-zinc-900 dark:text-zinc-200 dark:hover:bg-zinc-800" > {v}% </button> ))} </div> </div> ); }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| value | number | — | Progress from 0 to 100. |
| size | number | 128 | Diameter (px). |
| strokeWidth | number | 10 | Ring thickness. |
| showValue | boolean | true | Show the percentage. |