# Progress Show how much of a task is complete or indicate that work is still in progress. [Interactive guide](/docs/components/progress) · Forge 3.2.0 Use the API for your installed version. Run `npx --no-install wss3-forge api --json` inside the project. ## Implementation guidance ### When to use it Use Progress for a meaningful completion measure. Use indeterminate progress during work with no reliable completion value. ### How to compose it Name the indicator and pass value, min and max in the same unit. Use Progress for a compact track or ProgressRing for a compact percentage ring. ### What to verify Verify zero, the midpoint and completion. Confirm the selected backend's indeterminate state omits a numeric value and follows reduced motion. ## Usage ```tsx import { Progress, ProgressRing, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue } from 'wss3-forge' ``` - Give the indicator an accessible name using aria-label, aria-labelledby or a visible ProgressLabel. - Set value to the current measurement and use min and max to describe its range. The track grows from the start edge in either reading direction. - Use a null value for an indeterminate operation. React Aria uses isIndeterminate. Reduced-motion preferences suppress the moving indicator. - Progress includes a track by default. In Forge, Base UI and React Aria, set showTrack={false} to supply your own ProgressTrack and ProgressIndicator. - Use Progress for a linear indicator and ProgressRing for a single completion percentage in a circle. Give each a descriptive label. ## Guide ### Unknown duration Omit a percentage when the task has no known total. Use isIndeterminate on the React Aria entry. ```tsx ``` ### Custom track Replace the default track when the layout needs a different height. ```tsx ``` ## Runnable examples ### Upload progress ```tsx import { useEffect, useState } from 'react' import { Progress } from 'wss3-forge' function UploadProgress() { const [value, setValue] = useState(13) useEffect(() => { const timer = window.setTimeout(() => setValue(66), 500) return () => window.clearTimeout(timer) }, []) return } export default function Example() { return () } ``` ### Label ```tsx import { Progress, ProgressLabel, ProgressValue } from 'wss3-forge' function LabelledProgress({ rtl = false }: { rtl?: boolean }) { return {rtl ? 'تقدم الرفع' : 'Upload progress'} } export default function Example() { return () } ``` ### Controlled ```tsx import { useState } from 'react' import { Progress, Slider, VStack } from 'wss3-forge' function ControlledProgress() { const [value, setValue] = useState(50) return } export default function Example() { return () } ``` ### RTL ```tsx import { useState } from 'react' import { Progress, ProgressLabel, ProgressValue, Switch, VStack } from 'wss3-forge' function LabelledProgress({ rtl = false }: { rtl?: boolean }) { return {rtl ? 'تقدم الرفع' : 'Upload progress'} } function DirectionPreview() { const [rtl, setRtl] = useState(true) return } export default function Example() { return () } ``` ### Linear bar ```tsx import { Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, VStack } from 'wss3-forge' export default function Example() { return ( Workspace setup ) } ``` ### Progress ring ```tsx import { ProgressRing } from 'wss3-forge' export default function Example() { return () } ``` ## Primitive libraries ### Base UI Supply a number or null as value. min, max, locale and format configure the reading. Use getAriaValueText to customize its accessible text. ```sh npm install wss3-forge @base-ui/react ``` ```tsx import { Progress } from 'wss3-forge/base-ui' export default function Transfer() { return } ``` #### Preview ```tsx import { useEffect, useState } from 'react' import { Progress } from 'wss3-forge/base-ui' function UploadProgress() { const [value, setValue] = useState(13) useEffect(() => { const timer = window.setTimeout(() => setValue(66), 500) return () => window.clearTimeout(timer) }, []) return } export default function Example() { return () } ``` #### Label ```tsx import { Progress, ProgressLabel, ProgressValue } from 'wss3-forge/base-ui' export default function Example() { return ( Upload progress ) } ``` #### Controlled ```tsx import { useState } from 'react' import { Slider, VStack } from 'wss3-forge' import { Progress } from 'wss3-forge/base-ui' export default function ControlledProgress() { const [value, setValue] = useState(50) return ( ) } ``` #### RTL ```tsx import { useState } from 'react' import { Switch, VStack } from 'wss3-forge' import { Progress, ProgressLabel, ProgressValue } from 'wss3-forge/base-ui' export default function Example() { const [rtl, setRtl] = useState(true) const dir = rtl ? 'rtl' : 'ltr' const locale = rtl ? 'ar-EG' : 'en' const label = rtl ? 'تقدم الرفع' : 'Upload progress' return ( {label} ) } ``` ### Radix Progress supplies the track and indicator. Use an external label with aria-labelledby, max for the range and getValueLabel to format its accessible value. ```sh npm install wss3-forge radix-ui ``` ```tsx import { Progress } from 'wss3-forge/radix' export default function Transfer() { return } ``` #### Preview ```tsx import { useEffect, useState } from 'react' import { Progress } from 'wss3-forge/radix' function UploadProgress() { const [value, setValue] = useState(13) useEffect(() => { const timer = window.setTimeout(() => setValue(66), 500) return () => window.clearTimeout(timer) }, []) return } export default function Example() { return () } ``` #### Label ```tsx import { useId } from 'react' import { HStack, Text, VStack } from 'wss3-forge' import { Progress } from 'wss3-forge/radix' export default function Example() { const id = useId() const formatted = new Intl.NumberFormat('en', { style: 'percent' }).format(0.56) return ( Upload progress formatted} /> ) } ``` #### Controlled ```tsx import { useState } from 'react' import { Slider, VStack } from 'wss3-forge' import { Progress } from 'wss3-forge/radix' export default function ControlledProgress() { const [value, setValue] = useState(50) return ( ) } ``` #### RTL ```tsx import { useState, useId } from 'react' import { HStack, Text, VStack, Switch } from 'wss3-forge' import { Progress } from 'wss3-forge/radix' export default function Example() { const [rtl, setRtl] = useState(true) const dir = rtl ? 'rtl' : 'ltr' const locale = rtl ? 'ar-EG' : 'en' const label = rtl ? 'تقدم الرفع' : 'Upload progress' const id = useId() const formatted = new Intl.NumberFormat(locale, { style: 'percent' }).format(0.56) return (
{label} formatted} />
) } ``` ### React Aria Set minValue, maxValue and formatOptions on Progress. Use ProgressLabel and ProgressValue for visible text or read percentage and valueText in a render callback. ```sh npm install wss3-forge react-aria-components ``` ```tsx import { Progress } from 'wss3-forge/react-aria' export default function Transfer() { return } ``` #### Preview ```tsx import { useEffect, useState } from 'react' import { Progress } from 'wss3-forge/react-aria' function UploadProgress() { const [value, setValue] = useState(13) useEffect(() => { const timer = window.setTimeout(() => setValue(66), 500) return () => window.clearTimeout(timer) }, []) return } export default function Example() { return () } ``` #### Label ```tsx import { Progress, ProgressLabel, ProgressValue, I18nProvider } from 'wss3-forge/react-aria' export default function Example() { return ( Upload progress ) } ``` #### Controlled ```tsx import { useState } from 'react' import { Slider, VStack } from 'wss3-forge' import { Progress } from 'wss3-forge/react-aria' export default function ControlledProgress() { const [value, setValue] = useState(50) return ( ) } ``` #### RTL ```tsx import { useState } from 'react' import { Switch, VStack } from 'wss3-forge' import { Progress, ProgressLabel, ProgressValue, I18nProvider } from 'wss3-forge/react-aria' export default function Example() { const [rtl, setRtl] = useState(true) const dir = rtl ? 'rtl' : 'ltr' const locale = rtl ? 'ar-EG' : 'en' const label = rtl ? 'تقدم الرفع' : 'Upload progress' return ( {label} ) } ``` ## Root package API ### Progress Show how much of a task is complete or indicate that work is still in progress. Props type: `ProgressProps` Native attributes: AriaAttributes, DOMAttributes, HTMLAttributes **Composition exports** - `ProgressRing` (named export) - `ProgressIndicator` (named export) - `ProgressLabel` (named export) - `ProgressTrack` (named export) - `ProgressValue` (named export) - `value` — `number | null` A null value indicates ongoing work with an unknown completion time. - `min?` — `number` Default `0`. - `max?` — `number` Default `100`. - `locale?` — `Intl.LocalesArgument` - `children?` — `ReactNode` - `showTrack?` — `boolean` Default `true`. Disable the automatic track to render a custom ProgressTrack. - `ref?` — `React.LegacyRef | undefined` ### ProgressRing Props type: `ProgressRingProps` - `value` — `number` - `size?` — `number` Default `90`. - `thickness?` — `number` Default `10`. - `color?` — `string` Default `'var(--chart-primary)'`. - `showLabel?` — `boolean` Default `true`. - `animated?` — `boolean` Default `true`. - `label?` — `string` - `className?` — `string` - `style?` — `React.CSSProperties` ### ProgressIndicator Props type: `HTMLAttributes` Native attributes: AriaAttributes, DOMAttributes, HTMLAttributes - `ref?` — `React.LegacyRef | undefined` ### ProgressLabel Props type: `HTMLAttributes` Native attributes: AriaAttributes, DOMAttributes, HTMLAttributes - `ref?` — `React.LegacyRef | undefined` ### ProgressTrack Props type: `HTMLAttributes` Native attributes: AriaAttributes, DOMAttributes, HTMLAttributes - `ref?` — `React.LegacyRef | undefined` ### ProgressValue Props type: `ProgressValueProps` Native attributes: AriaAttributes, DOMAttributes, HTMLAttributes - `children?` — `(formattedValue: string) => ReactNode` - `ref?` — `React.LegacyRef | undefined` ## Related types ```ts export interface ProgressProps extends Omit, 'children'> { /** A null value indicates ongoing work with an unknown completion time. */ value: number | null min?: number max?: number locale?: Intl.LocalesArgument children?: ReactNode /** Disable the automatic track to render a custom ProgressTrack. */ showTrack?: boolean } interface ProgressRingProps { value: number // 0-100 size?: number thickness?: number color?: string showLabel?: boolean animated?: boolean label?: string className?: string style?: React.CSSProperties } export interface ProgressValueProps extends Omit, 'children'> { children?: (formattedValue: string) => ReactNode } ``` ## Optional primitive contracts - [wss3-forge/base-ui · Progress contract](/ai/skill/primitive-api/Progress.json) - [wss3-forge/radix · Progress contract](/ai/skill/primitive-api/Progress.json) - [wss3-forge/react-aria · Progress contract](/ai/skill/primitive-api/Progress.json)