Skip to content
Cynosurev0.5.0
SearchStorybookGitHubnpmColour mode: System. Switch to Light

Components / Feedback and display

ProgressBar

Shows how far a task has got: an upload, an export, the steps of a setup. When the amount is unknown it shows a moving segment instead.

Reports its value

When to useLink to "When to use"

  • A task with a measurable amount (bytes, files, steps) that takes long enough to watch.
  • A task in progress whose length is unknown, shown in place of the result: indeterminate.

Use something else when:

  • the wait is short and inside a button: the Button's loading state
  • a small inline busy indicator is enough: LoadingDots
  • the person sets the value: a Slider

UsageLink to "Usage"

tsx
Copy
import { ProgressBar } from "@arshad-shah/cynosure";

<ProgressBar label="Uploading 3 files" value={uploaded} max={total} showValue />
<ProgressBar label="Preparing export" indeterminate />

Leave value out (or pass indeterminate) while the amount is unknown, then pass it once you know it. Values outside 0…max are clamped.

Indeterminate

Value textLink to "Value text"

By default the value reads as a percentage. Pass labels.value to describe it in your own words; the same text is shown with showValue and read by screen readers.

Labels and hidden label

A slim bar in a rowLink to "A slim bar in a row"

With labelHidden and no showValue, the bar is only its track: no label row, as tall as size makes it, and still named by label. Put it in a row of text (a query plan's cost, a quota beside its number) and give it the space with style={{ flex: 1 }}; it fills from the reading start in right-to-left text too.

tsx
Copy
<Inline gap="2" align="center">
  <Text size="sm">Seq Scan</Text>
  <ProgressBar label="Cost 1234.5" labelHidden value={45} size="sm" tone="warning" style={{ flex: 1 }} />
  <Text size="sm" tone="muted">cost: 1234.5</Text>
</Inline>
Slim inline bar in arow

PropsLink to "Props"

Every prop of ProgressBar
PropWhat it doesTypeDefault
labelRequired
Accessible name, shown above the bar unless labelHidden.string
labelHidden
Visually hide the label (it still names the bar).boolean
value
Current value between 0 and max. Leave it out (or pass indeterminate) when progress is unknown.number
max
The value that means complete. Default 100.number100
indeterminate
Progress is happening but its amount is unknown.boolean
showValue
Show the value text at the end of the label row.boolean
segments
Parts drawn end to end instead of one fill, from offset: a request's timing (DNS, connect, wait, download) or a waterfall row. Each has a label (read out) and a tone or category color.ProgressSegment[]
offset
Where the first segment starts, in the same units as max. Default 0.number0
marker
A thin mark across the track at this value (a target, a second position).number
markerLabel
Read with the value when there is a marker. Default "marker at 75%".string"marker at 75%"
tone
Colour of the fill. Default "accent"."accent" | "neutral" | "danger" | "success" | "warning" | "info""accent"
size
Bar thickness. xs is a hairline track with smaller label text, for dense desktop chrome. Default "md".DenseSize"md"
labels
Replace the built-in English text: the value text.Partial<ProgressBarLabels>
className
Added to the root element, for layout.string
style
Layout only. Restyle through --cy-progress-bar-* tokens.CSSProperties

Generated from the type definitions in @arshad-shah/cynosure 0.5.0.

Behaviour and accessibilityLink to "Behaviour and accessibility"

  • Role: role="progressbar", named by label, with aria-valuemin, aria-valuemax, aria-valuenow and aria-valuetext. Indeterminate bars have no current value and are aria-busy.
  • Announcements: a progress bar is not a live region. To announce completion, say so in the page (a Notice or a Toast).
  • Contrast: the fill keeps at least 3:1 against its track in every tone, in light and dark modes.
  • Direction: fills from the inline start, so from the right in right-to-left text.
  • Motion: the fill eases between values; the indeterminate segment sweeps, and stands still in the middle under reduced motion.
Visible in every tone and mode

ThemingLink to "Theming"

size sets the thickness: xs 2, sm 4, md 8 and lg 12 px. xs also sets smaller label and value text and a tighter gap, for dense desktop chrome.

Tokens: --cy-progress-bar-height-{xs,sm,md,lg}, --cy-progress-bar-radius and --cy-progress-bar-track.

ts
Copy
createTheme({ components: { progressBar: { heightMd: "6px", radius: "2px" } } });

LoadingDots · Toast · Notice

These examples run Cynosure 0.5.0 (commit 50ce30b), the version on npm.

Getting started
Theming
Icons
Accessibility
Code editors and highlighters
Using Cynosure without React
Build-tool adapters
Components
Accordion
AppShell
AspectRatio
Breadcrumbs
Calendar
Card
Container
Disclosure
Divider
DocumentViewport
Grid
Inline
PageHeader
PanZoomCanvas
ScrollArea
SideNav
SortableList
SplitPane
Stack
StatusBar
Tabs
TitleBar
Toolbar
Tree
VirtualList
ZoomControls
Announcer
Avatar
Badge
CodeBlock
DescriptionList
EmptyState
ErrorBoundary
Field
Heading
IconTile
Image
Kbd
List
LoadingDots
Notice
ProgressBar
Prose
Skeleton
Stat
Steps
Table
Text
Button
Checkbox
Checklist
ColorField
ColorSwatches
Combobox
CompareSlider
CopyButton
DateField
FileDrop
IconButton
KeyValueEditor
Link
NumberField
Pagination
PathField
RadioGroup
SearchField
SegmentedControl
Select
SelectionFrame
SignaturePad
Slider
Switch
TagInput
TextArea
TextField
ThemeToggle
TimeField
ButtonBase
ChoiceBase
DialogBase
FileInputBase
HiddenValue
Icon
InputBase
LinkBase
LiveRegion
TextAreaBase
ChatMessage
Choice
DataGrid
DeviceFrame
HighlightedText
HotkeyField
ListRow
OptionList
OverlayFrame
QRCode
RowActions
Section
SiteFooter
SiteHeader
SkipLink
SortButton
VisuallyHidden
CommandPalette
ContextMenu
Dialog
FloatingToolbar
HoverCard
Menu
Menubar
Popover
ProgressOverlay
Sheet
Toast
Tooltip
Changelog