At a glance
- DtProgressBar shows how far along one operation is, like a file upload or a contacts import. It fills the width of its container.
- Set
value(0 to 100) when the operation reports progress, andindeterminateuntil it does. The same bar switches from one to the other in place. - It's display only and draws no text. You add the label and readout, and name the bar with
aria-labeloraria-labelledby. - It pairs with DtProgressCircle, which now takes the same
valueandindeterminateprops. - Component docs • Storybook
Meet DtProgressBar
The common case is an upload. The bar is indeterminate until the first progress event, then counts up on the same bar and turns positive at 100. It uses this Vue setup:
import { computed, ref } from 'vue';
const uploaded = ref(null); // null until the first progress event
const uploadDone = computed(() => uploaded.value === 100);
// In your upload's progress handler: uploaded.value = Math.floor(event.loaded / event.total * 100);
Render the percentage from the same number you pass to value. The bar doesn't announce its changes. The hidden role="status" region says "Upload complete" at 100.
Bar or circle?
DtProgressBar and DtProgressCircle take the same value, indeterminate and kind. The difference is space. Use the bar when the indicator can span its container, like an upload row or a dialog. Use the circle in a small fixed spot, like over a thumbnail or beside a file name in a dense list.
DtProgressCircle's progress prop still works but is deprecated. Use value instead.
Slider or progress bar?
DtSlider and DtProgressBar look alike. Choose by who sets the value. When a person sets it, like a volume level or a price range, use DtSlider: it's an input with a focusable thumb (role="slider"). When the app reports it, use DtProgressBar. It's output, isn't focusable and has role="progressbar".
What DtProgressBar isn't for
- Letting people pick a value. That's DtSlider.
- Waits that never report a value, like fetching data or saving a form. Use DtLoader.
- Values that aren't a task's progress, like storage used or a rating.
- Steps in a multi-step flow.
- A built-in label or readout. Put text beside it, as in the first example.
See the DtProgressBar and DtProgressCircle documentation for kinds, sizes, readout patterns and accessibility guidance.
