Circular Progress
edgecom/circular-progressFreeComponent
The Edgecom Circular Progress component.
Install it
npx shadcn@latest add https://design.edgecom.ai/r/circular-progress.jsonSource
1'use client'23import * as React from 'react'45import { cn } from '@/lib/utils'67interface CircularProgressProps extends React.HTMLAttributes<HTMLDivElement> {8 value: number9 renderLabel?: (progress: number) => React.ReactNode10 size?: number11 strokeWidth?: number12 circleStrokeWidth?: number13 progressStrokeWidth?: number14 shape?: 'square' | 'round'15 progressClassName?: string16 progressBgClassName?: string17 labelClassName?: string18 showLabel?: boolean19 variant?: 'default' | 'animated'20 gaugePrimaryColor?: string21 gaugeSecondaryColor?: string22 trackDashArray?: string | number23}2425const CircularProgress = ({26 value,27 renderLabel,28 className,29 progressClassName,30 progressBgClassName,31 labelClassName,32 showLabel,33 shape = 'round',34 size = 100,35 strokeWidth,36 circleStrokeWidth = 10,37 progressStrokeWidth = 10,38 variant = 'default',39 gaugePrimaryColor = 'currentColor',40 gaugeSecondaryColor = 'currentColor',41 trackDashArray,42 ...props43}: CircularProgressProps) => {44 const effectiveCircleWidth = strokeWidth ?? circleStrokeWidth45 const effectiveProgressWidth = strokeWidth ?? progressStrokeWidth46 const maxStroke = Math.max(effectiveCircleWidth, effectiveProgressWidth)4748 const radius = variant === 'animated' ? 45 : (size - maxStroke) / 249 const currentPercent = Math.min(Math.max(value, 0), 100)5051 if (variant === 'animated') {52 const gapPercent = 553 const dashFactor = (2 * Math.PI * 45) / 10054 const circumference = 2 * Math.PI * 455556 const primaryDash = `${currentPercent * dashFactor} ${circumference}`57 const primaryRotate = -90 + gapPercent * 0 * 3.65859 const secondaryDash = trackDashArray60 ? trackDashArray61 : `${Math.max(0, 90 - currentPercent) * dashFactor} ${circumference}`6263 const secondaryRotate = 360 - 90 - gapPercent * 3.66465 return (66 <div67 className={cn('relative flex shrink-0 items-center justify-center', className)}68 style={{ width: size, height: size }}69 {...props}70 >71 <svg viewBox='0 0 100 100' className='size-full overflow-visible'>72 {/* Dynamic Background Track */}73 <circle74 cx='50'75 cy='50'76 r={45}77 fill='none'78 stroke={gaugeSecondaryColor}79 strokeWidth={effectiveCircleWidth}80 strokeDasharray={secondaryDash}81 strokeLinecap={trackDashArray ? 'butt' : shape}82// … truncated
What it pulls in
Other registry items
Files it writes
More from edgecom
All 66 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | edgecom | Components | Free | 2 deps | |
| Alertalert | edgecom | Components | Free | 1 dep | |
| Alert Dialogalert-dialog | edgecom | Components | Free | 1 dep | |
| Avataravatar | edgecom | Components | Free | 1 dep | |
| Badgebadge | edgecom | Components | Free | 2 deps | |
| Bannerbanner | edgecom | Components | Free | 1 dep | |
| Breadcrumbbreadcrumb | edgecom | Components | Free | 2 deps | |
| Buttonbutton | edgecom | Components | Free | 2 deps |
