Progress
How far along a task is, or that it is still working.
SourceStyles source@monoline/react 0.5.0Markdown for AI toolsstable
- Built on radix-ui/Progress
- role=progressbar with aria-valuenow, aria-valuemin and aria-valuemax.
- Indeterminate omits aria-valuenow.
- aria-label is required.
- Styles in one file:
progress-bar.css
Import
import '@monoline/css';
import {Progress} from '@monoline/react';
Not installed yet? Pick a route.
Copies the source and its styles into your project.
npx monoline add progress
It needs radix-ui; install it if your project does not have it:
npm install radix-ui
Usage
import {Progress} from '@monoline/react';
<div style={{display: 'grid', gap: 'var(--s4)', maxWidth: 420}}>
<Progress aria-label="Upload" value={62} />
<Progress aria-label="Waiting" />
</div>
Examples
Determinate and indeterminate
Props
ProgressProps
| Prop | Type | Default | Description |
|---|---|---|---|
aria-label required | string | – | Accessible name. Required: a progress bar without one is meaningless to assistive tech. |
Data Attributes
State is exposed through attributes. Style it with these selectors, not with class toggles.
| Attribute | Stylesheet |
|---|---|
[data-state="indeterminate"] | progress-bar.css |
CSS classes
| Class | Stylesheet |
|---|---|
.progress-bar | progress-bar.css |
.progress-fill | progress-bar.css |
Customization
Style it with the kit's tokens in your own CSS, loaded after @monoline/css. Prefer the attributes above over extra classes. See Theming for every token.
app.css
.progress-bar {
border-color: var(--accent);
}
.progress-bar[data-state="indeterminate"] {
background: var(--wash);
}
Try the props
Change a prop and the component above updates; the code below is what you would write. To edit the code itself, use the Playground.
example.tsx
<Progress aria-label="Upload" value={60} />
Accessibility
- role=progressbar with aria-valuenow, aria-valuemin and aria-valuemax.
- Indeterminate omits aria-valuenow.
- aria-label is required.