Progress

Lockness UI Component

VIEW

DOCUMENTATION

Progress

A progress bar component for displaying completion status. Pure CSS implementation with multiple variants, sizes, label positioning options, striped effects, and outlined wrapper.

Installation

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

Usage

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

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

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

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

// Different sizes
<Progress value={30} size="sm" />
<Progress value={60} size="lg" />

Label Options

tsx
// Label above the bar (left-right layout)
<Progress value={50} showLabel />

// Floating label that follows the progress
<Progress value={50} floatingLabel />

// Label inside the bar
<Progress value={50} innerLabel size="lg" />

// Label at the end (right side)
<Progress value={50} endLabel />

Vertical Progress

tsx
<Progress value={50} vertical />

Custom Thickness

tsx
// Thickness in Tailwind spacing units (1 = 0.25rem)
<Progress value={50} thickness={6} />
<Progress value={50} vertical thickness={4} />

Striped Progress

tsx
// Static stripes
<Progress value={50} striped />

// Animated stripes
<Progress value={70} striped animated />

// With variant
<Progress value={80} striped animated variant="success" />

Outlined Progress

tsx
// Outlined wrapper around the bar
<Progress value={50} outlined />

// Outlined with variant
<Progress value={75} outlined variant="success" />

// Combine with striped and animated
<Progress value={80} outlined striped animated variant="success" />

Props

PropTypeDefaultDescription
valuenumber0Current progress value (0-100)
maxnumber100Maximum value
variant'default' | 'success' | 'warning' | 'destructive''default'Visual style variant
size'sm' | 'default' | 'lg''default'Size of the progress bar
showLabelbooleanfalseShow percentage label above the bar
floatingLabelbooleanfalseShow floating label that follows the progress
innerLabelbooleanfalseShow label inside the progress bar
endLabelbooleanfalseShow label at the end (right side)
verticalbooleanfalseDisplay progress bar vertically
stripedbooleanfalseDisplay progress with diagonal stripes effect
animatedbooleanfalseAnimate the stripes (requires striped=true)
outlinedbooleanfalseAdd an outlined wrapper around the progress bar
thicknessnumber-Custom thickness in Tailwind spacing units (overrides size)
classstring-Additional CSS class names
idstring-Element id attribute

Variants

VariantDescription
defaultPrimary color (uses --primary)
successGreen color for completed/successful states
warningYellow color for warning states
destructiveRed color for error/danger states

Sizes

SizeHeight
sm0.25rem (h-1)
default0.5rem (h-2)
lg1rem (h-4)

CSS Variables

VariableDefaultDescription
--progress-border-radiusvar(--radius)Border radius of the bar
--progress-backgroundvar(--secondary)Background color of the track
--progress-height-sm0.25remHeight for sm size
--progress-height-default0.5remHeight for default size
--progress-height-lg1remHeight for lg size
--progress-outline-border-width2pxBorder width for outlined wrapper
--progress-outline-padding0.25remPadding inside outlined wrapper
--progress-outline-border-radiuscalc(var(--radius) + 4px)Border radius for outlined wrapper
--progress-stripe-size1remSize of diagonal stripes
--progress-animation-duration1sDuration of stripe animation

Theming

The Progress component can be customized using CSS variables. Override these variables to match your design system.

Available CSS Variables

VariableDefaultDescription
--progress-border-radiusvar(--radius)Border radius of the bar
--progress-backgroundvar(--secondary)Background color of the track
--progress-height-sm0.25remHeight for sm size
--progress-height-default0.5remHeight for default size
--progress-height-lg1remHeight for lg size
--progress-outline-border-width2pxBorder width for outlined wrapper
--progress-outline-padding0.25remPadding inside outlined wrapper
--progress-outline-border-radiuscalc(var(--radius) + 4px)Border radius for outlined wrapper
--progress-stripe-size1remSize of diagonal stripes
--progress-animation-duration1sDuration of stripe animation

Theming Examples

Custom Heights

css
:root {
    --progress-height-sm: 0.125rem; /* Thinner small size */
    --progress-height-default: 0.75rem; /* Thicker default */
    --progress-height-lg: 1.5rem; /* Larger large size */
}

Custom Border Radius

css
:root {
    --progress-border-radius: 0; /* Square corners */
}

/* or */
:root {
    --progress-border-radius: 9999px; /* Fully rounded */
}

Custom Track Background

css
:root {
    --progress-background: hsl(240 5% 85%); /* Custom gray */
}

.dark {
    --progress-background: hsl(240 5% 20%); /* Darker for dark mode */
}

Custom Outline Style

css
:root {
    --progress-outline-border-width: 3px; /* Thicker border */
    --progress-outline-padding: 0.5rem; /* More padding */
    --progress-outline-border-radius: 1rem; /* More rounded */
}

Custom Stripe Animation

css
:root {
    --progress-stripe-size: 1.5rem; /* Larger stripes */
    --progress-animation-duration: 2s; /* Slower animation */
}

Complete Custom Theme

css
:root {
    /* Heights */
    --progress-height-sm: 0.25rem;
    --progress-height-default: 0.625rem;
    --progress-height-lg: 1.25rem;

    /* Appearance */
    --progress-border-radius: 0.5rem;
    --progress-background: hsl(210 40% 90%);

    /* Outline */
    --progress-outline-border-width: 1px;
    --progress-outline-padding: 0.375rem;
    --progress-outline-border-radius: 0.75rem;

    /* Stripes */
    --progress-stripe-size: 0.75rem;
    --progress-animation-duration: 1.5s;
}

.dark {
    --progress-background: hsl(210 40% 15%);
}

Features

  • Pure CSS - No JavaScript required
  • Smooth animations - Animated transitions on value change
  • Multiple label options - Above, floating, inner, or end position
  • Vertical support - Can be displayed vertically
  • Custom thickness - Override size with exact thickness
  • Striped effect - Diagonal stripes with optional animation
  • Outlined wrapper - Border wrapper with padding
  • Fully customizable - CSS variables for theming
  • Accessible - Proper ARIA attributes (progressbar role)

BASIC USAGE

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

<Progress value={50} />

WITH LABEL

Progress33%
Progress66%
Progress100%
tsx
<Progress value={66} showLabel />

FLOATING LABEL

25%
50%
75%
100%
tsx
<Progress value={50} floatingLabel />

INNER LABEL

25%
50%
75%
100%
tsx
<Progress value={50} innerLabel />

END LABEL

25%
50%
75%
100%
tsx
<Progress value={50} endLabel />

VARIANTS

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

VERTICAL

tsx
<div class="flex gap-x-8">
  <Progress value={25} vertical />
  <Progress value={50} vertical />
  <Progress value={75} vertical />
</div>

STRIPED PROGRESS

tsx
<Progress value={50} striped />

STRIPED ANIMATED PROGRESS

tsx
<Progress value={50} striped animated />

STRIPED PROGRESS VARIANTS

tsx
<Progress value={80} striped animated variant="success" />

STRIPED PROGRESS SIZES

tsx
<Progress value={60} striped size="lg" />

OUTLINED PROGRESS

tsx
<Progress value={50} outlined />

OUTLINED PROGRESS VARIANTS

tsx
<Progress value={75} outlined variant="success" />

OUTLINED STRIPED ANIMATED PROGRESS

tsx
<Progress value={75} outlined striped animated variant="success" />

OUTLINED PROGRESS SIZES

tsx
<Progress value={60} outlined size="lg" />
<Progress value={75} outlined striped animated size="lg" variant="success" />

REAL-WORLD EXAMPLES

Uploading document.pdf2.4 MB / 3.2 MB
Profile Completion4 of 6 steps
Storage Used8.5 GB / 10 GB

You're running low on storage space.

tsx
<div class="space-y-3">
    <div class="flex justify-between text-sm">
        <span class="font-medium">Storage Used</span>
        <span class="text-muted-foreground">8.5 GB / 10 GB</span>
    </div>
    <Progress value={85} variant="warning" />
</div>