steps.mdx 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. ---
  2. title: Steps
  3. summary: Steps are used to guide users through complex processes, making them easier and more intuitive. Breaking a multi-step process into smaller parts and tracking progress along the way helps users complete it successfully.
  4. new: true
  5. description: Simplify complex processes with steps.
  6. ---
  7. ## Default markup
  8. Steps provide a clear visual representation of a user’s progress through a multi-step process. By showing what has been completed and what remains, steps enhance usability and encourage task completion.
  9. To create a default progress tracker, use the `.steps` class and define each step as a `.step-item`. The active step clearly indicates the current position in the process.
  10. ```html
  11. <div class="steps">
  12. <a href="#" class="step-item">
  13. Step 1
  14. </a>
  15. <a href="#" class="step-item">
  16. Step 2
  17. </a>
  18. <a href="#" class="step-item active">
  19. Step 3
  20. </a>
  21. </div>
  22. ```
  23. The example below demonstrates a simple progress tracker with four steps, where the third step is active.
  24. ```html example centered
  25. <div class="steps">
  26. <a href="#" class="step-item">
  27. Step 1
  28. </a>
  29. <a href="#" class="step-item">
  30. Step 2
  31. </a>
  32. <a href="#" class="step-item active">
  33. Step 3
  34. </a>
  35. <span href="#" class="step-item">
  36. Step 4
  37. </span>
  38. </div>
  39. ```
  40. ## Tooltips
  41. Add tooltips, if you want to provide users with additional information about the steps they are expected to complete. Tooltips are displayed when a user hovers over a given step and help clarify what might not be clear from the interface.
  42. To add a tooltip, use the `data-bs-toggle="tooltip"` attribute and specify the tooltip content with the `title` attribute.
  43. ```html
  44. <a href="#" class="step-item" data-bs-toggle="tooltip" data-bs-placement="top" title="Step 1 description">
  45. Step 1
  46. </a>
  47. ```
  48. The example below demonstrates a progress tracker with tooltips for each step.
  49. ```html example centered height="20rem"
  50. <div class="steps">
  51. <a href="#" class="step-item" data-bs-toggle="tooltip" data-bs-placement="top" title="Step 1 description">
  52. Step 1
  53. </a>
  54. <a href="#" class="step-item" data-bs-toggle="tooltip" data-bs-placement="top" title="Step 2 description">
  55. Step 2
  56. </a>
  57. <a href="#" class="step-item active" data-bs-toggle="tooltip" data-bs-placement="top" title="Step 3 description">
  58. Step 3
  59. </a>
  60. <span href="#" class="step-item" data-bs-toggle="tooltip" data-bs-placement="top" title="Step 4 description">
  61. Step 4
  62. </span>
  63. </div>
  64. ```
  65. ## Color
  66. You can customize the default progress indicator by changing the color to one that better suits your design. Click [here](/docs/ui/base/colors) to see the range of available colors.
  67. ```html
  68. <div class="steps steps-green">
  69. ...
  70. </div>
  71. ```
  72. The example below demonstrates a progress tracker with two different color schemes.
  73. ```html example centered
  74. <div class="steps steps-green">
  75. <a href="#" class="step-item">
  76. Step 1
  77. </a>
  78. <a href="#" class="step-item">
  79. Step 2
  80. </a>
  81. <a href="#" class="step-item active">
  82. Step 3
  83. </a>
  84. <span href="#" class="step-item">
  85. Step 4
  86. </span>
  87. </div>
  88. <div class="steps steps-red">
  89. <a href="#" class="step-item">
  90. Step 1
  91. </a>
  92. <a href="#" class="step-item">
  93. Step 2
  94. </a>
  95. <a href="#" class="step-item active">
  96. Step 3
  97. </a>
  98. <span href="#" class="step-item">
  99. Step 4
  100. </span>
  101. </div>
  102. ```
  103. ## Steps without title
  104. For designs with limited space, use progress indicators without titles and add tooltips to provide the necessary details.
  105. ```html example centered
  106. <div class="steps">
  107. <a href="#" class="step-item" data-bs-toggle="tooltip" data-bs-placement="top" title="Step 1 description"></a>
  108. <a href="#" class="step-item" data-bs-toggle="tooltip" data-bs-placement="top" title="Step 2 description"></a>
  109. <a href="#" class="step-item active" data-bs-toggle="tooltip" data-bs-placement="top" title="Step 3 description"></a>
  110. <span href="#" class="step-item" data-bs-toggle="tooltip" data-bs-placement="top" title="Step 4 description"></span>
  111. </div>
  112. ```
  113. ## Steps with numbers
  114. Use the `steps-counter` class to create a progress tracker with numbers instead of titles and change the color to customize it.
  115. ```html
  116. <div class="steps steps-counter">
  117. ...
  118. </div>
  119. ```
  120. The example below demonstrates a progress tracker with numbers and a different color scheme.
  121. ```html example centered
  122. <div class="steps steps-counter">
  123. <a href="#" class="step-item"></a>
  124. <a href="#" class="step-item active"></a>
  125. <span href="#" class="step-item"></span>
  126. <span href="#" class="step-item"></span>
  127. <span href="#" class="step-item"></span>
  128. </div>
  129. ```