BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/diceui/base/circular-progress

circular-progress

diceui-base/circular-progress
FreeComponent

diceui/base publishes no description for this item.

Install it

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

Source

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

What it pulls in

npm packages

  • @base-ui/react

Files it writes

  • ui/circular-progress.tsx

Facts

Registry
diceui/base
Type
registry:ui
Access
Free
Files written
1
Theme wiring
ships cssVars
Licence
the repository states none
First indexed
2026-08-09
Last confirmed
2 days ago

Go to the source

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

More from diceui/base

All 192 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
action-baraction-bardiceui/baseComponentsFree1 dep
angle-sliderangle-sliderdiceui/baseComponentsFree1 dep · 3 files
avatar-groupavatar-groupdiceui/baseComponentsFree1 dep
badge-overflowbadge-overflowdiceui/baseComponentsFree1 dep · 2 files
bannerbannerdiceui/baseComponentsFree1 dep
client-onlyclient-onlydiceui/baseComponentsFreeno deps
color-pickercolor-pickerdiceui/baseComponentsFree1 dep · 2 files
color-swatchcolor-swatchdiceui/baseComponentsFree1 dep
BlockDex

Built by

Kynth Studios

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 Studios

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 Studios

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