Duostrap Progress
A classic Duostrap progress bar supporting contextual gradient variants, determinate values, and indeterminate states.
Duostrap Progress preserves the classic 20px bar height, 4px corners, inset track shadow, vertical linear gradients, and 600ms width transition while reusing shared Base Progress semantics.
Preview
Section titled “Preview”<div class="w-[60%]">
<wc-duostrap-progress-root
id="hero-progress"
aria-label="Task progress"
value="13"
value-text="13%"
>
<wc-duostrap-progress-track>
<wc-duostrap-progress-indicator></wc-duostrap-progress-indicator>
</wc-duostrap-progress-track>
</wc-duostrap-progress-root>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const el = document.querySelector('#hero-progress');
setTimeout(() => {
if (el instanceof HTMLElement)
setElementProps(el, { value: 66, valueText: '66%' });
}, 500);
</script>Installation
Section titled “Installation”Available starting in 0.3.0-rc.1 and later releases. Import the parts from @proto.ui/prototypes-duostrap/progress:
import { progressRoot, progressLabel, progressTrack, progressIndicator, progressValue,} from '@proto.ui/prototypes-duostrap/progress';Compose Root, Label, Track, Indicator, and Value. Place Label and Value before Track for an inline header row above the bar:
<DuostrapProgressRoot variant="success" value={60} valueText="60%" className="w-full max-w-sm"> <DuostrapProgressLabel>Upload progress</DuostrapProgressLabel> <DuostrapProgressValue /> <DuostrapProgressTrack> <DuostrapProgressIndicator /> </DuostrapProgressTrack></DuostrapProgressRoot>ProgressRoot├── ProgressLabel├── ProgressValue└── ProgressTrack └── ProgressIndicator- Contextual variants:
RootandIndicatorsupportdefault,info,success,warning, anddangerclassic Duostrap gradients with the 600ms CSS ease width transition (respecting reduced-motion preferences). - Determinate and indeterminate:
valueclamps to[min, max](equal bounds evaluate to0%). Omittingvalueor settingindeterminate={true}enters indeterminate mode and omitsaria-valuenow. - Read-only display: Progress adds no Tab stop, and every part exposes synchronized
value,percentage,indeterminate, andstatusstates.
Examples
Section titled “Examples”Contextual Variants
Section titled “Contextual Variants”Classic Duostrap default, info, success, warning, and danger progress bar gradients.
<div class="w-full max-w-md">
<wc-duostrap-progress-root
variant="default"
value="40"
value-text="40%"
>
<wc-duostrap-progress-label>Default</wc-duostrap-progress-label>
<wc-duostrap-progress-value></wc-duostrap-progress-value>
<wc-duostrap-progress-track>
<wc-duostrap-progress-indicator></wc-duostrap-progress-indicator>
</wc-duostrap-progress-track>
</wc-duostrap-progress-root>
<wc-duostrap-progress-root
variant="info"
value="20"
value-text="20%"
>
<wc-duostrap-progress-label>Info</wc-duostrap-progress-label>
<wc-duostrap-progress-value></wc-duostrap-progress-value>
<wc-duostrap-progress-track>
<wc-duostrap-progress-indicator></wc-duostrap-progress-indicator>
</wc-duostrap-progress-track>
</wc-duostrap-progress-root>
<wc-duostrap-progress-root
variant="success"
value="60"
value-text="60%"
>
<wc-duostrap-progress-label>Success</wc-duostrap-progress-label>
<wc-duostrap-progress-value></wc-duostrap-progress-value>
<wc-duostrap-progress-track>
<wc-duostrap-progress-indicator></wc-duostrap-progress-indicator>
</wc-duostrap-progress-track>
</wc-duostrap-progress-root>
<wc-duostrap-progress-root
variant="warning"
value="80"
value-text="80%"
>
<wc-duostrap-progress-label>Warning</wc-duostrap-progress-label>
<wc-duostrap-progress-value></wc-duostrap-progress-value>
<wc-duostrap-progress-track>
<wc-duostrap-progress-indicator></wc-duostrap-progress-indicator>
</wc-duostrap-progress-track>
</wc-duostrap-progress-root>
<wc-duostrap-progress-root
variant="danger"
value="90"
value-text="90%"
>
<wc-duostrap-progress-label>Danger</wc-duostrap-progress-label>
<wc-duostrap-progress-value></wc-duostrap-progress-value>
<wc-duostrap-progress-track>
<wc-duostrap-progress-indicator></wc-duostrap-progress-indicator>
</wc-duostrap-progress-track>
</wc-duostrap-progress-root>
</div>Inline ProgressLabel and ProgressValue aligned above the 20px track.
<wc-duostrap-progress-root
class="w-full max-w-sm"
value="56"
value-text="56%"
>
<wc-duostrap-progress-label>
Upload progress
</wc-duostrap-progress-label>
<wc-duostrap-progress-value></wc-duostrap-progress-value>
<wc-duostrap-progress-track>
<wc-duostrap-progress-indicator></wc-duostrap-progress-indicator>
</wc-duostrap-progress-track>
</wc-duostrap-progress-root>Controlled
Section titled “Controlled”Control the progress bar interactively with a Slider to observe the 600ms width transition.
<div class="flex w-full max-w-sm flex-col gap-4">
<wc-duostrap-progress-root
id="controlled-progress"
value="50"
value-text="50%"
>
<wc-duostrap-progress-label>
Completion
</wc-duostrap-progress-label>
<wc-duostrap-progress-value></wc-duostrap-progress-value>
<wc-duostrap-progress-track>
<wc-duostrap-progress-indicator></wc-duostrap-progress-indicator>
</wc-duostrap-progress-track>
</wc-duostrap-progress-root>
<wc-duostrap-slider-root
id="controlled-slider"
value="50"
min="0"
max="100"
step="1"
aria-label="Progress value"
>
<wc-duostrap-slider-track>
<wc-duostrap-slider-indicator></wc-duostrap-slider-indicator>
<wc-duostrap-slider-thumb></wc-duostrap-slider-thumb>
</wc-duostrap-slider-track>
</wc-duostrap-slider-root>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const progress = document.querySelector('#controlled-progress');
const slider = document.querySelector('#controlled-slider');
if (
progress instanceof HTMLElement &&
slider instanceof HTMLElement
) {
slider.addEventListener('valueChange', (event) => {
const next = Math.round(event.detail.value);
setElementProps(slider, { value: next });
setElementProps(progress, {
value: next,
valueText: `${next}%`,
});
});
}
</script>Indeterminate
Section titled “Indeterminate”Represent unknown progress with indeterminate and toggle back to a determinate percentage.
<wc-duostrap-progress-root class="w-full max-w-sm" indeterminate>
<wc-duostrap-progress-label>
Loading package…
</wc-duostrap-progress-label>
<wc-duostrap-progress-value></wc-duostrap-progress-value>
<wc-duostrap-progress-track>
<wc-duostrap-progress-indicator></wc-duostrap-progress-indicator>
</wc-duostrap-progress-track>
</wc-duostrap-progress-root>| Prop | Type | Default |
|---|---|---|
value | number undefined | omitted (indeterminate) |
min | number | 0 |
max | number | 100 |
indeterminate | boolean | false |
ariaLabel | string | '' |
valueText | string | '' |
variant | 'default' 'info' 'success' 'warning' 'danger' | 'default' |
dir | 'ltr' 'rtl' undefined | inherited |
Indicator and exposed states
Section titled “Indicator and exposed states”ProgressIndicatoraccepts an optionalvariantoverride ('default' | 'info' | 'success' | 'warning' | 'danger' | 'inherit', default'inherit').- All parts expose synchronized read-only states:
value,percentage,indeterminate, andstatus.