spinners.mdx 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. ---
  2. title: Spinners
  3. description: Spinners are used to show the loading state of a component or page. They provide feedback for an action a user has taken, when it takes a bit longer to complete.
  4. bootstrapLink: components/spinners/
  5. ---
  6. ## Default markup
  7. Use the default spinner to notify users that an action they have taken is in progress, helping them avoid confusion.
  8. ```html example code centered
  9. <div class="spinner-border"></div>
  10. ```
  11. ## Colors
  12. Choose one of the available colors to customize the spinner and make it suit your design.
  13. ```html example centered separated
  14. <div class="spinner-border text-blue" role="status"></div>
  15. <div class="spinner-border text-azure" role="status"></div>
  16. <div class="spinner-border text-indigo" role="status"></div>
  17. <div class="spinner-border text-purple" role="status"></div>
  18. <div class="spinner-border text-pink" role="status"></div>
  19. <div class="spinner-border text-red" role="status"></div>
  20. <div class="spinner-border text-orange" role="status"></div>
  21. <div class="spinner-border text-yellow" role="status"></div>
  22. <div class="spinner-border text-lime" role="status"></div>
  23. <div class="spinner-border text-green" role="status"></div>
  24. <div class="spinner-border text-teal" role="status"></div>
  25. <div class="spinner-border text-cyan" role="status"></div>
  26. ```
  27. ```html
  28. <div class="spinner-border text-blue" role="status"></div>
  29. <div class="spinner-border text-red" role="status"></div>
  30. ```
  31. ## Size
  32. Choose the size of your spinner. You can use the default size or use the `spinner-border-sm` class to display a smaller spinner.
  33. ```html example code centered separated
  34. <div class="spinner-border" role="status"></div>
  35. <div class="spinner-border spinner-border-sm" role="status"></div>
  36. ```
  37. ## Growing spinner
  38. Use the growing spinner, if you are looking for a more original design than a border spinner. The spinner grows to show the loading state.
  39. ```html example code centered
  40. <div class="spinner-grow" role="status"></div>
  41. ```
  42. Growing spinners also come in a variety of colors to choose from.
  43. ```html example centered separated
  44. <div class="spinner-grow text-blue" role="status"></div>
  45. <div class="spinner-grow text-azure" role="status"></div>
  46. <div class="spinner-grow text-indigo" role="status"></div>
  47. <div class="spinner-grow text-purple" role="status"></div>
  48. <div class="spinner-grow text-pink" role="status"></div>
  49. <div class="spinner-grow text-red" role="status"></div>
  50. <div class="spinner-grow text-orange" role="status"></div>
  51. <div class="spinner-grow text-yellow" role="status"></div>
  52. <div class="spinner-grow text-lime" role="status"></div>
  53. <div class="spinner-grow text-green" role="status"></div>
  54. <div class="spinner-grow text-teal" role="status"></div>
  55. <div class="spinner-grow text-cyan" role="status"></div>
  56. ```
  57. ```html
  58. <div class="spinner-grow text-blue" role="status"></div>
  59. <div class="spinner-grow text-azure" role="status"></div>
  60. ```
  61. ### Button with spinner
  62. Use buttons with spinners to notify users that an action they have taken by clicking the button is in progress and prevent them from clicking multiple times or giving up.
  63. ```html example centered separated code
  64. <a href="#" class="btn btn-primary">
  65. <span class="spinner-border spinner-border-sm me-2" role="status"></span>
  66. Button
  67. </a>
  68. <a href="#" class="btn btn-danger">
  69. <span class="spinner-border spinner-border-sm me-2" role="status"></span>
  70. Button
  71. </a>
  72. <a href="#" class="btn btn-warning">
  73. <span class="spinner-border spinner-border-sm me-2" role="status"></span>
  74. Button
  75. </a>
  76. <a href="#" class="btn btn-success">
  77. <span class="spinner-border spinner-border-sm me-2" role="status"></span>
  78. Button
  79. </a>
  80. <a href="#" class="btn">
  81. <span class="spinner-border spinner-border-sm me-2" role="status"></span>
  82. Button
  83. </a>
  84. ```
  85. ## Animated dots
  86. ```html example centered code
  87. <h1>Loading<span class="animated-dots"></span></h1>
  88. ```
  89. ```html example centered code separated
  90. <a href="#" class="btn btn-primary">
  91. Loading<span class="animated-dots"></span>
  92. </a>
  93. <a href="#" class="btn btn-primary disabled">
  94. Loading<span class="animated-dots"></span>
  95. </a>
  96. ```