Animated Circular Progress Bar
magicui/animated-circular-progress-barFreeComponent
Animated Circular Progress Bar is a component that displays a circular gauge with a percentage value.
Live preview
live · rendered by the registry
Rendered by magicui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://magicui.design/r/animated-circular-progress-bar.jsonSource
1import { cn } from "@/lib/utils"23interface AnimatedCircularProgressBarProps {4 max?: number5 min?: number6 value: number7 gaugePrimaryColor: string8 gaugeSecondaryColor: string9 className?: string10}1112export function AnimatedCircularProgressBar({13 max = 100,14 min = 0,15 value = 0,16 gaugePrimaryColor,17 gaugeSecondaryColor,18 className,19}: AnimatedCircularProgressBarProps) {20 const circumference = 2 * Math.PI * 4521 const percentPx = circumference / 10022 const currentPercent = Math.round(((value - min) / (max - min)) * 100)2324 return (25 <div26 className={cn("relative size-40 text-2xl font-semibold", className)}27 style={28 {29 "--circle-size": "100px",30 "--circumference": circumference,31 "--percent-to-px": `${percentPx}px`,32 "--gap-percent": "5",33 "--offset-factor": "0",34 "--transition-length": "1s",35 "--transition-step": "200ms",36 "--delay": "0s",37 "--percent-to-deg": "3.6deg",38 transform: "translateZ(0)",39 } as React.CSSProperties40 }41 >42 <svg43 fill="none"44 className="size-full"45 strokeWidth="2"46 viewBox="0 0 100 100"47 >48 {currentPercent <= 90 && currentPercent >= 0 && (49 <circle50 cx="50"51 cy="50"52 r="45"53 strokeWidth="10"54 strokeDashoffset="0"55 strokeLinecap="round"56 strokeLinejoin="round"57 className="opacity-100"58 style={59 {60 stroke: gaugeSecondaryColor,61 "--stroke-percent": 90 - currentPercent,62 "--offset-factor-secondary": "calc(1 - var(--offset-factor))",63 strokeDasharray:64 "calc(var(--stroke-percent) * var(--percent-to-px)) var(--circumference)",65 transform:66 "rotate(calc(1turn - 90deg - (var(--gap-percent) * var(--percent-to-deg) * var(--offset-factor-secondary)))) scaleY(-1)",67 transition: "all var(--transition-length) ease var(--delay)",68 transformOrigin:69 "calc(var(--circle-size) / 2) calc(var(--circle-size) / 2)",70 } as React.CSSProperties71 }72 />73 )}74 <circle75 cx="50"76 cy="50"77 r="45"78 strokeWidth="10"79 strokeDashoffset="0"80 strokeLinecap="round"81 strokeLinejoin="round"82// … truncated
Files it writes
More from magicui
All 247 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Androidandroid | magicui | Components | Free | no deps | |
| Animated Beamanimated-beam | magicui | Components | Free | 1 dep | |
| Animated Gradient Textanimated-gradient-text | magicui | Components | Free | no deps | |
| Animated Grid Patternanimated-grid-pattern | magicui | Components | Free | 1 dep | |
| Animated Listanimated-list | magicui | Components | Free | 1 dep | |
| Animated Shiny Textanimated-shiny-text | magicui | Components | Free | no deps | |
| Theme Toggleranimated-theme-toggler | magicui | Components | Free | 1 dep | |
| Aurora Textaurora-text | magicui | Components | Free | no deps |
