Skip to content

← All components

Display and feedback

CircularProgress

Determinate circular loader with an accessible percentage value.

Live example

24%64%

Usage

Each example includes the complete adapter-specific parameter reference. Copy it as a starting point, then remove options your use case does not need.

React

tsx
import { CircularProgress } from "@cofob/design-system-react";

/**
 * Complete CircularProgress parameter reference.
 * @param value
 *   type: number
 *   required
 *   example: 64
 * @param max
 *   type: number
 *   default: 100
 *   example: {max}
 * @param label
 *   type: string | renderable content
 *   required
 *   example: "Accessible label"
 * @param size
 *   type: "sm" | "md" | "lg" (plus heading sizes)
 *   default: "md"
 *   example: "md"
 * @param animated
 *   type: boolean
 *   default: false
 *   example: {animated}
 * @param showValue
 *   type: boolean
 *   default: true
 *   example: {showValue}
 * @param formatValue
 *   type: (percentage: number, value: number, max: number) => renderable content
 *   default: —
 *   example: {formatValue}
 * @param span attributes
 *   type: native element attributes
 *   default: —
 *   example: class / style / aria-* / data-*
 */
export function CircularProgressExample() {
  return (
    <CircularProgress label="Uploading assets" value={64} animated showValue />
  );
}

Svelte

svelte
<script lang="ts">
  import { CircularProgress } from "@cofob/design-system-svelte";

  // Complete CircularProgress parameter reference.
  // value
  //   type: number
  //   required
  //   example: 64
  // max
  //   type: number
  //   default: 100
  //   example: {max}
  // label
  //   type: string | renderable content
  //   required
  //   example: "Accessible label"
  // size
  //   type: "sm" | "md" | "lg" (plus heading sizes)
  //   default: "md"
  //   example: "md"
  // animated
  //   type: boolean
  //   default: false
  //   example: {animated}
  // showValue
  //   type: boolean
  //   default: true
  //   example: {showValue}
  // formatValue
  //   type: (percentage: number, value: number, max: number) => renderable content
  //   default: —
  //   example: {formatValue}
  // span attributes
  //   type: native element attributes
  //   default: —
  //   example: class / style / aria-* / data-*
</script>

<CircularProgress label="Uploading assets" value={64} />

HTML

html
<!--
  Complete CircularProgress parameter reference.
  value
    type: number
    required
    example: 64
  max
    type: number
    default: 100
    example: {max}
  label
    type: string | renderable content
    required
    example: "Accessible label"
  size
    type: "sm" | "md" | "lg" (plus heading sizes)
    default: "md"
    example: "md"
  animated
    type: boolean
    default: false
    example: {animated}
  showValue
    type: boolean
    default: true
    example: {showValue}
  formatValue
    type: (percentage: number, value: number, max: number) => renderable content
    default: —
    example: {formatValue}
  span attributes
    type: native element attributes
    default: —
    example: class / style / aria-* / data-*
-->
<span class="cf-circular-progress" data-animated="true" role="progressbar" aria-label="Uploading assets" aria-valuenow="64" aria-valuemin="0" aria-valuemax="100">…</span>

Parameters

Adapter differences are explicit. Native element attributes are forwarded in React and Svelte and can be written directly in HTML.

ParameterTypeDefaultAdaptersExampleDescription
valuerequirednumberrequiredReact · Svelte · HTML64Selected or reported native value.
maxnumber100React · Svelte · HTML{max}Highest allowed range or progress value.
labelrequiredstring | renderable contentrequiredReact · Svelte · HTML"Accessible label"Visible or accessible name, depending on the component.
size"sm" | "md" | "lg" (plus heading sizes)"md"React · Svelte · HTML"md"Applies a design-system size token.
animatedbooleanfalseReact · Svelte · HTML{animated}Enables optional progress motion while preserving reduced-motion behavior.
showValuebooleantrueReact · Svelte · HTML{showValue}Shows formatted output beside the slider label.
formatValue(percentage: number, value: number, max: number) => renderable contentReact · Svelte · HTML{formatValue}Formats visible numeric output without changing the underlying value.
span attributesnative element attributesReact · Svelte · HTMLclass / style / aria-* / data-*Forwards native class/style, accessibility, event, and data attributes to the root element.