BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/dashboardblocks/progress-bar

Progress Bar

dashboardblocks/progress-bar
FreeComponent

A progress bar component.

Live preview

live · rendered by the registry
Rendered by dashboardblocks on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://dashboardblocks.com/r/progress-bar.json

Source

registry/components/dashboardblocks/progress-bar.tsxdashboardblocks.com/r/progress-bar.json
1'use client'
2
3import { useInView } from '@/registry/hooks/use-in-view'
4import { useEffect, useState } from 'react'
5
6import { cn } from '@/lib/utils'
7
8export interface ProgressBarProps {
9 className?: string
10 fillClassName?: string
11 percentage: number
12}
13
14export const ProgressBar = ({
15 className,
16 percentage,
17 fillClassName,
18}: ProgressBarProps) => {
19 const [width, setWidth] = useState(0)
20 const { isInView, ref } = useInView()
21
22 const safePercentage = Number.isFinite(percentage) ? percentage : 0
23 const normalized = Math.min(100, Math.max(0, safePercentage))
24
25 useEffect(() => {
26 if (isInView) {
27 // Small delay to ensure the initial render happens at 0
28 const timer = requestAnimationFrame(() => {
29 setWidth(normalized)
30 })
31 return () => cancelAnimationFrame(timer)
32 }
33 }, [isInView, normalized])
34
35 return (
36 <div
37 ref={ref as React.RefObject<HTMLDivElement>}
38 className={cn('h-2 w-full rounded-full bg-muted', className)}
39 >
40 <div
41 className={cn(
42 'h-full rounded-full bg-primary transition-width! duration-1000 ease-out-expo',
43 fillClassName,
44 )}
45 style={{ width: `${width}%` }}
46 />
47 </div>
48 )
49}
50
51export interface SegmentedProgressBarProps {
52 className?: string
53 segments: Array<{
54 color?: string
55 label?: string
56 value: number
57 }>
58 total: number
59}
60
61export const SegmentedProgressBar = ({
62 className,
63 segments,
64 total,
65}: SegmentedProgressBarProps) => {
66 const [animatedMultiplier, setAnimatedMultiplier] = useState(0)
67 const { isInView, ref } = useInView()
68 const safeTotal = total > 0 ? total : 1
69
70 useEffect(() => {
71 if (isInView) {
72 // Small delay to ensure the initial render happens at 0
73 const timer = requestAnimationFrame(() => {
74 setAnimatedMultiplier(1)
75 })
76 return () => cancelAnimationFrame(timer)
77 }
78 }, [isInView])
79
80 return (
81 <div
82 ref={ref as React.RefObject<HTMLDivElement>}
83 className={cn('flex h-2 w-full overflow-hidden rounded-full bg-muted', className)}
84 >
85 {segments.map((segment, index) => {
86 const percentage = (segment.value / safeTotal) * 100
87 const animatedWidth = Math.max(0, percentage) * animatedMultiplier
88 return (
89 <div
90 key={segment.label || index}
91 className='h-full transition-width! duration-1000 ease-out-expo first:rounded-l-full last:rounded-r-full'
92 style={{
93// … truncated

What it pulls in

Other registry items

  • https://dashboardblocks.com/r/use-in-view.json

Files it writes

  • registry/components/dashboardblocks/progress-bar.tsx

Facts

Registry
dashboardblocks
Type
registry:component
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-01
Last confirmed
yesterday

Go to the source

Docs on dashboardblocks dashboardblocks.com LGLabGreg/dashboardblocks on GitHub Raw registry item This item as JSON

More from dashboardblocks

All 36 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Activity Feedactivity-feeddashboardblocksComponentsFree1 dep
activity-feed-01activity-feed-01dashboardblocksComponentsFree1 dep
activity-feed-02activity-feed-02dashboardblocksComponentsFree1 dep
activity-feed-03activity-feed-03dashboardblocksComponentsFree1 dep
activity-feed-04activity-feed-04dashboardblocksComponentsFree1 dep
activity-feed-05activity-feed-05dashboardblocksComponentsFree1 dep
Animated Numberanimated-numberdashboardblocksComponentsFreeno deps
Animated Waveanimated-wavedashboardblocksComponentsFreeno deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex