progress.mdx 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. ---
  2. title: Progress bars
  3. description: Progress bars are used to provide feedback on an action status and inform users of the current progress. Although seemingly small interface elements, they are extremely hepful in managing users' expectations and preventing them from abandoning a process they have initiated.
  4. bootstrapLink: components/progress
  5. ---
  6. ## Default markup
  7. To create a default progress bar, add a `.progress` class to a `<div>` element. Thanks to that, you will be able to notify users how long they have to wait for a process to complete.
  8. ```html example columns={1} centered
  9. <div class="progress">
  10. <div class="progress-bar" style="width: 38%"></div>
  11. </div>
  12. ```
  13. ```html
  14. <div class="progress">
  15. <div class="progress-bar" style="width: 38%" role="progressbar" aria-valuenow="38" aria-valuemin="0" aria-valuemax="100" aria-label="38% Complete">
  16. <span class="visually-hidden">38% Complete</span>
  17. </div>
  18. </div>
  19. ```
  20. ## Progress size
  21. Using Bootstrap’s typical naming structure, you can create a standard progress bar or scale it up or down to different sizes based on what’s needed.
  22. ```html code example columns={1} centered
  23. <div class="progress progress-sm">
  24. <div class="progress-bar" style="width: 57%" role="progressbar" aria-valuenow="57" aria-valuemin="0" aria-valuemax="100" aria-label="57% Complete">
  25. <span class="visually-hidden">57% Complete</span>
  26. </div>
  27. </div>
  28. ```
  29. ## Progress without value
  30. Remove the displayed value by adding the `.visually-hidden` class.
  31. ```html code example columns={1} centered
  32. <div class="progress">
  33. <div class="progress-bar" style="width: 75%" role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100" aria-label="75% Complete">
  34. <span class="visually-hidden">75% Complete</span>
  35. </div>
  36. </div>
  37. ```
  38. ## Indeterminate progress
  39. You can create a progress bar which shows indeterminate progress by adding `.progress-bar-indeterminate` to the `.progress-bar` element.
  40. ```html code example columns={1} centered
  41. <div class="progress progress-sm">
  42. <div class="progress-bar progress-bar-indeterminate"></div>
  43. </div>
  44. ```
  45. ## Native progress element
  46. You can also use native HTML5 `<progress>` element.
  47. ```html code example columns={1} centered
  48. <progress class="progress progress-sm" value="15" max="100" />
  49. ```
  50. ## Progress color
  51. Customize the color of the progress bar to suit your design. Click [here](colors) to see the list of available colors.
  52. ```html code example columns={1} centered separated
  53. <div class="progress">
  54. <div class="progress-bar bg-red" style="width: 24%" role="progressbar" aria-valuenow="24" aria-valuemin="0" aria-valuemax="100" aria-label="24% Complete">
  55. <span class="visually-hidden">24% Complete</span>
  56. </div>
  57. </div>
  58. <div class="progress">
  59. <div class="progress-bar bg-green" style="width: 45%" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" aria-label="45% Complete">
  60. <span class="visually-hidden">45% Complete</span>
  61. </div>
  62. </div>
  63. <div class="progress">
  64. <div class="progress-bar bg-purple" style="width: 64%" role="progressbar" aria-valuenow="64" aria-valuemin="0" aria-valuemax="100" aria-label="64% Complete">
  65. <span class="visually-hidden">64% Complete</span>
  66. </div>
  67. </div>
  68. <div class="progress">
  69. <div class="progress-bar bg-blue" style="width: 38%" role="progressbar" aria-valuenow="38" aria-valuemin="0" aria-valuemax="100" aria-label="38% Complete">
  70. <span class="visually-hidden">38% Complete</span>
  71. </div>
  72. </div>
  73. ```