tsimport {XDSProgressBar} from '@xds/core/ProgressBar'
| Guidance | Practices |
|---|---|
| Do | Use a determinate bar when the total amount of work is known, and indeterminate when it's not. |
| Do | Choose a color variant that matches the context β accent for general progress, positive for success, warning or negative for alerts. |
| Do | Always provide a label, even if hidden β screen readers need it to announce what's loading. |
| Don't | Place icons or labels inside the bar β compose them alongside it using layout components. |
| Don't | Use a progress bar for instant actions β it's meant for operations that take noticeable time. |
| Don't | Use multiple progress bars stacked together for the same operation β use one bar with a value label instead. |
tsx'use client';βimport {XDSProgressBar} from '@xds/core/ProgressBar';import {XDSCenter} from '@xds/core/Center';import {XDSVStack} from '@xds/core/Layout';import {XDSText} from '@xds/core/Text';βexport default function ProgressBarCustomFormat() {return (<XDSCenter width={300}><XDSVStack gap={1}><XDSProgressBarvalue={3.2}max={5}label="Disk usage"hasValueLabelformatValueLabel={(value: number, max: number) =>`${value} GB / ${max} GB`}/><XDSText type="supporting" color="secondary">1.8 GB remaining</XDSText></XDSVStack></XDSCenter>);}
tsx'use client';βimport {XDSProgressBar} from '@xds/core/ProgressBar';import {XDSCenter} from '@xds/core/Center';βexport default function ProgressBarIndeterminate() {return (<XDSCenter width={300}><XDSProgressBar isIndeterminate label="Loading..." /></XDSCenter>);}
tsx'use client';βimport {XDSProgressBar} from '@xds/core/ProgressBar';import {XDSCenter} from '@xds/core/Center';import {XDSVStack} from '@xds/core/Layout';βexport default function ProgressBarSemanticVariants() {return (<XDSCenter width={300}><XDSVStack gap={4}><XDSProgressBar value={60} label="Accent" variant="accent" hasValueLabel /><XDSProgressBar value={80} label="Positive" variant="positive" hasValueLabel /><XDSProgressBar value={50} label="Warning" variant="warning" hasValueLabel /><XDSProgressBar value={92} label="Negative" variant="negative" hasValueLabel /><XDSProgressBar value={35} label="Neutral" variant="neutral" hasValueLabel /></XDSVStack></XDSCenter>);}
tsx'use client';βimport {XDSProgressBar} from '@xds/core/ProgressBar';import {XDSCenter} from '@xds/core/Center';βexport default function ProgressBarWithValueLabel() {return (<XDSCenter width={300}><XDSProgressBar value={75} label="Storage used" hasValueLabel /></XDSCenter>);}
tsx'use client';βimport {XDSProgressBar} from '@xds/core/ProgressBar';βexport default function ProgressBarShowcase() {return <XDSProgressBar value={60} label="Progress" />;}