BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/diceui/radix/circular-progress

circular-progress

diceui-radix/circular-progress
FreeComponent

diceui/radix publishes no description for this item.

Install it

npx shadcn@latest add https://raw.githubusercontent.com/sadmann7/diceui/HEAD/docs/public/r/styles/radix-nova/circular-progress.json

Source

ui/circular-progress.tsxraw.githubusercontent.com/sadmann7/diceui/HEAD/docs/public/r/styles/radix-nova/circular-progress.json · first 6 KB
1"use client";
2
3import { Slot as SlotPrimitive } from "radix-ui";
4import * as React from "react";
5import { cn } from "@/lib/utils";
6
7const CIRCULAR_PROGRESS_NAME = "CircularProgress";
8const INDICATOR_NAME = "CircularProgressIndicator";
9const TRACK_NAME = "CircularProgressTrack";
10const RANGE_NAME = "CircularProgressRange";
11const VALUE_TEXT_NAME = "CircularProgressValueText";
12
13const DEFAULT_MAX = 100;
14
15type ProgressState = "indeterminate" | "complete" | "loading";
16
17function getProgressState(
18 value: number | undefined | null,
19 maxValue: number,
20): ProgressState {
21 return value == null
22 ? "indeterminate"
23 : value === maxValue
24 ? "complete"
25 : "loading";
26}
27
28function getIsValidNumber(value: unknown): value is number {
29 return typeof value === "number" && Number.isFinite(value);
30}
31
32function getIsValidMaxNumber(max: unknown): max is number {
33 return getIsValidNumber(max) && max > 0;
34}
35
36function getIsValidValueNumber(
37 value: unknown,
38 min: number,
39 max: number,
40): value is number {
41 return getIsValidNumber(value) && value <= max && value >= min;
42}
43
44function getDefaultValueText(value: number, min: number, max: number): string {
45 const percentage = max === min ? 100 : ((value - min) / (max - min)) * 100;
46 return `${Math.round(percentage)}%`;
47}
48
49function getInvalidValueError(
50 propValue: string,
51 componentName: string,
52): string {
53 return `Invalid prop \`value\` of value \`${propValue}\` supplied to \`${componentName}\`. The \`value\` prop must be a number between \`min\` and \`max\` (inclusive), or \`null\`/\`undefined\` for indeterminate progress. The value will be clamped to the valid range.`;
54}
55
56function getInvalidMaxError(propValue: string, componentName: string): string {
57 return `Invalid prop \`max\` of value \`${propValue}\` supplied to \`${componentName}\`. Only numbers greater than 0 are valid. Defaulting to ${DEFAULT_MAX}.`;
58}
59
60interface CircularProgressContextValue {
61 value: number | null;
62 valueText: string | undefined;
63 max: number;
64 min: number;
65 state: ProgressState;
66 radius: number;
67 thickness: number;
68 size: number;
69 center: number;
70 circumference: number;
71 percentage: number | null;
72 valueTextId?: string;
73}
74
75const CircularProgressContext =
76 React.createContext<CircularProgressContextValue | null>(null);
77
78function useCircularProgressContext(consumerName: string) {
79 const context = React.useContext(CircularProgressContext);
80 if (!context) {
81 throw new Error(
82// … truncated

What it pulls in

npm packages

  • radix-ui

Files it writes

  • ui/circular-progress.tsx

Facts

Registry
diceui/radix
Type
registry:ui
Access
Free
Files written
1
Theme wiring
ships cssVars
Licence
the repository states none
First indexed
2026-08-01
Last confirmed
yesterday

Go to the source

www.diceui.com sadmann7/diceui on GitHub Raw registry item This item as JSON

More from diceui/radix

All 58 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
action-baraction-bardiceui/radixComponentsFree1 dep · 2 files
angle-sliderangle-sliderdiceui/radixComponentsFree1 dep · 3 files
avatar-groupavatar-groupdiceui/radixComponentsFree1 dep
badge-overflowbadge-overflowdiceui/radixComponentsFree1 dep · 2 files
bannerbannerdiceui/radixComponentsFree1 dep
checkbox-groupcheckbox-groupdiceui/radixComponentsFree1 dep
client-onlyclient-onlydiceui/radixComponentsFreeno deps
color-pickercolor-pickerdiceui/radixComponentsFree1 dep · 3 files
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