Progress bar
A labelled bar that fills as something completes, with the figure beside it.
Uploading 3 files
64%
Options
Code
import "./progress-bar.css";
export function ProgressBar({ label, value }) {
const percent = Math.max(0, Math.min(100, Math.round(value)));
return (
<div className="dh-progress">
<div className="dh-progress-head">
<span>{label}</span>
<span>{percent}%</span>
</div>
<div className="dh-progress-track" role="progressbar" aria-label={label} aria-valuemin={0} aria-valuemax={100} aria-valuenow={percent}>
<i style={{ width: percent + "%" }} />
</div>
</div>
);
}.dh-progress {
width: 15em;
color: var(--dh-fg, #171717);
font-size: 1em;
}
.dh-progress-head {
display: flex;
justify-content: space-between;
margin-bottom: 0.6em;
font-size: 0.85em;
letter-spacing: -0.01em;
}
.dh-progress-head span:last-child {
color: var(--dh-muted, #5c5c5c);
font-variant-numeric: tabular-nums;
}
.dh-progress-track {
height: 0.25em;
overflow: hidden;
border-radius: 999px;
background: var(--dh-well, #ededeb);
}
.dh-progress-track i {
display: block;
height: 100%;
border-radius: inherit;
background: var(--dh-accent, var(--dh-fg, #171717));
transition: width 320ms cubic-bezier(0.32, 0.72, 0, 1);
}
@media (prefers-reduced-motion: reduce) {
.dh-progress-track i {
transition: none;
}
}<div class="dh-progress">
<div class="dh-progress-head">
<span>Uploading 3 files</span>
<span>64%</span>
</div>
<div class="dh-progress-track" role="progressbar" aria-label="Uploading 3 files" aria-valuemin="0" aria-valuemax="100" aria-valuenow="64">
<i style="width: 64%"></i>
</div>
</div>.dh-progress {
width: 15em;
color: var(--dh-fg, #171717);
font-size: 1em;
}
.dh-progress-head {
display: flex;
justify-content: space-between;
margin-bottom: 0.6em;
font-size: 0.85em;
letter-spacing: -0.01em;
}
.dh-progress-head span:last-child {
color: var(--dh-muted, #5c5c5c);
font-variant-numeric: tabular-nums;
}
.dh-progress-track {
height: 0.25em;
overflow: hidden;
border-radius: 999px;
background: var(--dh-well, #ededeb);
}
.dh-progress-track i {
display: block;
height: 100%;
border-radius: inherit;
background: var(--dh-accent, var(--dh-fg, #171717));
transition: width 320ms cubic-bezier(0.32, 0.72, 0, 1);
}
@media (prefers-reduced-motion: reduce) {
.dh-progress-track i {
transition: none;
}
}Progress bar is not in the Figma file yet.
Use the React or HTML code for now.