DevExtreme v24.1 is now available.

Explore our newest features/capabilities and share your thoughts with us.

Your search did not match any results.

JavaScript/jQuery Progress Bar

This demo shows how to configure the JavaScript ProgressBar component.

To create a JavaScript ProgressBar, declare it in markup. You can specify the following properties to change the JavaScript ProgressBar's numeric scale:

  • min and max
    The min and max properties limit the range of accepted values.

  • value
    This property specifies the current value. If you want to switch the JavaScript ProgressBar to an indeterminate state, set the value property to false.

This demo uses the custom timer function to increase the JavaScript ProgressBar's value.

DevExtreme Accessibility Compliance
DevExtreme component libraries meet a variety of WCAG and Section 508 compliance standards. To assess this demo’s accessibility level, click the Run AXE® Validation button to launch the AXE® web accessibility evaluation tool.
All trademarks or registered trademarks are property of their respective owners. AXE® Terms of Use
The overall accessibility level of your application depends on the ProgressBar features used.
Backend API
$(() => { let seconds = 10; let inProgress = false; let intervalId; const progressBarStatus = $('#progressBarStatus').dxProgressBar({ min: 0, max: 100, width: '90%', elementAttr: { 'aria-label': 'Progress Bar', }, statusFormat(ratio) { return `Loading: ${ratio * 100}%`; }, onComplete(e) { inProgress = false; progressButton.option('text', 'Restart progress'); e.element.addClass('complete'); }, }).dxProgressBar('instance'); const progressButton = $('#progress-button').dxButton({ text: 'Start progress', width: 200, onClick() { $('#progressBarStatus').removeClass('complete'); if (inProgress) { progressButton.option('text', 'Continue progress'); clearInterval(intervalId); } else { progressButton.option('text', 'Stop progress'); setCurrentStatus(); intervalId = setInterval(timer, 1000); } inProgress = !inProgress; }, }).dxButton('instance'); function setCurrentStatus() { progressBarStatus.option('value', (10 - seconds) * 10); $('#timer').text((`0${seconds}`).slice(-2)); } function timer() { seconds -= 1; setCurrentStatus(); if (seconds === 0) { clearInterval(intervalId); seconds = 10; } } });
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <title>DevExtreme Demo</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))</script> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/24.1.7/css/dx.light.css" /> <script src="js/dx.all.js"></script> <link rel="stylesheet" type="text/css" href="styles.css" /> <script src="index.js"></script> </head> <body class="dx-viewport"> <div class="demo-container"> <div class="form"> <div id="progress-button"></div> <div class="progress-info"> Time left 00:00:<span id="timer">10</span> </div> <div id="progress"><div id="progressBarStatus"></div></div> </div> </div> </body> </html>
.form { padding: 20% 0; text-align: center; } #progress-button { margin-bottom: 20px; } #progressBarStatus { display: inline-block; padding-top: 8px; } .complete .dx-progressbar-range { background-color: green; }

When the JavaScript ProgressBar reaches the maximum value, the complete event occurs. Use the onComplete function to handle it.

The progress status displays a ratio between the current and maximum values and indicates the progress. Use the showStatus property to display or hide the status string. To format the status string, use the statusFormat function.