Components / Progress
Progress
Show task completion with a square, monospaced Radix progress bar. Use a known value for measurable work, or an indeterminate bar when the amount is unknown. Unlike Slider, Progress displays a value; it does not let people choose one.
Storybook runs locally or as a separately hosted build; no hosted Storybook is configured. Source and setup links match the install revision.
Usage playground
Change a local example value or its maximum. Advance example adds one tenth of the maximum; it does not start an upload, request or background task.
40 of 100 reviewed
'use client';
import { useId, useState } from 'react';
import { Progress } from "@/components/ui/yads-progress";
const layout = { display: 'grid', gap: '.75rem', width: '100%', maxWidth: '24rem', minWidth: 0 } as const;
Installation
pnpm dlx [email protected] add biehlio/yet-another-design-system/progress#e7b31d0e0c9d8b24d53e97ca38b3b68d345e9f40This revision-pinned command installs yads-progress, Radix Progress 1.2.1, its scoped stylesheet and JetBrains Mono. Import { Progress } from @/components/ui/yads-progress (adjust your alias). No Tailwind, reset, global CSS or theme provider is required. A containing .dark class selects dark colors; light is the default.
Copy sample copies a complete React module, including layout and recipe CSS, even when collapsed. Samples need only this registry item; interactive modules include a client boundary. Playground controls are documentation controls, not extra Progress props.
Values and maximum
Zero is a known value, not an unknown amount. A value equal to max is complete. Custom units use a positive max and getValueLabel for meaningful value text; the visible text is authored separately.
'use client';
import { useId, useState } from 'react';
import { Progress } from "@/components/ui/yads-progress";
const layout = { display: 'grid', gap: '.75rem', width: '100%', maxWidth: '24rem', minWidth: 0 } as const;
Indeterminate progress
Pass null (or omit value) when completion cannot be measured. There is no aria-valuenow or percentage value text. Reduced motion keeps a stationary segment instead of moving it; visible context still explains the unknown amount.
Example of an unknown amount of work; no task is running.
'use client';
import { useId, useState } from 'react';
import { Progress } from "@/components/ui/yads-progress";
const layout = { display: 'grid', gap: '.75rem', width: '100%', maxWidth: '24rem', minWidth: 0 } as const;
className customization
Use ordinary CSS to change root height or width without replacing scoped theme colors or state styling. The copied module includes this recipe. Inline style also passes through.
60% reviewed
'use client';
import { useId, useState } from 'react';
import { Progress } from "@/components/ui/yads-progress";
const layout = { display: 'grid', gap: '.75rem', width: '100%', maxWidth: '24rem', minWidth: 0 } as const;
Accessibility
- Name the task. Use visible text outside the bar and connect it with aria-labelledby, or supply aria-label. Keep labels and descriptions outside the progressbar because its descendants are presentational.
- Distinguish known and unknown work. Radix supplies role="progressbar", aria-valuemin="0", aria-valuemax and, for known values, aria-valuenow and rounded percentage aria-valuetext. Customize value text for units. null omits both current value and value text; do not invent a percentage for unknown work.
- Display, not input. Progress has no keyboard interaction, thumb, disabled or readOnly state and is not in the Tab order by default. Use Slider to let someone select a value. It does not serialize a form field. Native div attributes and events pass through, but adding tabIndex or overriding ARIA does not turn it into a control.
- Explain changes when needed. Progress is not a live region and does not guarantee announcements of updates or completion. Your application owns task state, errors, cancellation and any separate, appropriately timed status message. Avoid announcing every increment. When applicable, manage aria-busy on the work region, not as an invented Progress behavior.
- Respect reduced motion. The preference disables fill transitions and the indeterminate animation. A stationary segment remains visible. Keep persistent text explaining unknown work; do not rely only on color or motion.
Standalone defaults to light; a containing .dark class selects scoped dark colors without a global theme provider.
API reference
Import { Progress, type ProgressProps } from @/components/ui/yads-progress. Props follow Radix Progress 1.2.1 Root, excluding children and asChild: this wrapper owns one div root and its indicator. It forwards native div attributes, data-*, aria-* and events, plus the root ref. There is no onValueChange, defaultValue, min, disabled or readOnly API.
On narrow screens, focus the table and scroll horizontally to read all columns.
| Prop | Type | Default | Description |
|---|---|---|---|
value | number | null | null | Known value from 0 through max inclusive. null or omitted means indeterminate. No internal task or timer is started. |
max | number | 100 | Positive maximum. The minimum is always 0. Use finite numbers for meaningful completion. |
getValueLabel | (value: number, max: number) => string | Rounded percentage | Sets aria-valuetext for known values, not visible text. Not called for indeterminate values. |
aria-label / aria-labelledby | string | Not set | Supply an accessible name; prefer a visible span connected with aria-labelledby. No name or ID is generated. |
aria-describedby | string | Not set | Connect persistent context or an explanation of unknown work. |
className / style | string / CSSProperties | Not set | Forwarded to the root while retaining its scoped class. |
ref | React.Ref<HTMLDivElement> | Not set | Forwarded to the root div for measurement or inspection, not a focusable input. |
Validation and state attributes
Zero produces an empty known fill; value equal to max fills the bar completely. Negative, NaN or above-max values fall back to indeterminate rather than clamping. Invalid max (zero, negative or NaN) falls back to 100; value is validated against that resolved maximum. Radix may log invalid prop diagnostics. Match upstream by using finite values and positive finite maxima: Radix 1.2.1 technically accepts positive Infinity, but infinite ranges do not describe meaningful completion.
Root and indicator expose data-state (loading, complete or indeterminate), data-max and, only for known values, data-value. The fill uses the same validation as Radix so invalid values never produce a misleading determinate width. Native props can override Radix-generated ARIA; do not override role or value semantics inconsistently.
Playground defaults and limitations
Reset restores value 40 and max 100. Changing the maximum preserves the completion ratio; Advance example adds one tenth of max, or starts at zero from indeterminate. These are local documentation interactions, not real work or network activity. Progress manages neither timing nor task lifecycle.