CircularProgress

Lockness UI Component

VIEW

DOCUMENTATION

CircularProgress

A circular progress indicator using SVG. Pure CSS implementation with smooth animations, multiple variants, and sizes.

Installation

bash
deno run -A jsr:@lockness/ui add circularprogress

Usage

tsx
import { CircularProgress } from '@lockness/ui/components'

// Basic usage
<CircularProgress value={50} />

// With label
<CircularProgress value={75} showLabel />

// Success variant
<CircularProgress value={100} variant="success" showLabel />

// Different sizes
<CircularProgress value={60} size="sm" />
<CircularProgress value={60} size="xl" showLabel />

Variants

VariantDescription
defaultPrimary color
successGreen color for completed/successful states
warningYellow color for warning states
destructiveRed color for error/danger states
tsx
<CircularProgress value={60} showLabel />
<CircularProgress value={100} variant="success" showLabel />
<CircularProgress value={45} variant="warning" showLabel />
<CircularProgress value={25} variant="destructive" showLabel />

Sizes

SizeDimension
sm2.5rem
default4rem
lg6rem
xl8rem
tsx
<CircularProgress value={60} size="sm" showLabel />
<CircularProgress value={60} size="default" showLabel />
<CircularProgress value={60} size="lg" showLabel />
<CircularProgress value={60} size="xl" showLabel />

Stroke Width

Customize the thickness of the progress circle.

tsx
<CircularProgress value={60} strokeWidth={1} showLabel />
<CircularProgress value={60} strokeWidth={2} showLabel />
<CircularProgress value={60} strokeWidth={4} showLabel />

Props

PropTypeDefaultDescription
valuenumber0Current progress value (0-100)
maxnumber100Maximum value
variantdefault | success | warning | destructivedefaultVisual style variant
sizesm | default | lg | xldefaultSize of the circular progress
strokeWidthnumber3Stroke width of the progress circle
showLabelbooleanfalseShow percentage label in the center
classstring-Additional CSS class names
idstring-Element id attribute

Accessibility

The component includes proper ARIA attributes:

  • role="progressbar" for semantic meaning
  • aria-valuenow for the current value
  • aria-valuemin and aria-valuemax for the range

Examples

Loading State

tsx
<div class='flex items-center gap-4'>
    <CircularProgress value={75} showLabel />
    <span>Loading...</span>
</div>

Dashboard Metrics

tsx
<div class='flex gap-8'>
    <div class='text-center'>
        <CircularProgress value={85} variant='success' size='lg' showLabel />
        <p class='mt-2 text-sm'>Performance</p>
    </div>
    <div class='text-center'>
        <CircularProgress value={62} size='lg' showLabel />
        <p class='mt-2 text-sm'>Progress</p>
    </div>
    <div class='text-center'>
        <CircularProgress
            value={23}
            variant='destructive'
            size='lg'
            showLabel
        />
        <p class='mt-2 text-sm'>Errors</p>
    </div>
</div>

Completion Indicator

tsx
<CircularProgress
    value={100}
    variant='success'
    size='xl'
    showLabel
/>

BASIC USAGE

tsx
import { CircularProgress } from '@lockness/ui/components'

<CircularProgress value={50} />

WITH LABEL

25%
50%
75%
tsx
<CircularProgress value={75} showLabel />

SIZES

60%
60%
60%
60%
tsx
<CircularProgress value={60} size="sm" showLabel />
<CircularProgress value={60} showLabel />
<CircularProgress value={60} size="lg" showLabel />
<CircularProgress value={60} size="xl" showLabel />

VARIANTS

60%
80%
45%
30%
tsx
<CircularProgress value={80} variant="success" showLabel />

CUSTOM STROKE WIDTH

60%
60%
60%
tsx
<CircularProgress value={60} strokeWidth={4} showLabel />