modals.mdx 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. ---
  2. title: Modals
  3. description: Use Bootstrap’s JavaScript modal plugin to add dialogs to your site for lightboxes, user notifications, or completely custom content.
  4. ---
  5. ## Default markup
  6. ```html example code centered height="30rem"
  7. <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal">
  8. Launch demo modal
  9. </button>
  10. <div class="modal" id="exampleModal" tabindex="-1">
  11. <div class="modal-dialog" role="document">
  12. <div class="modal-content">
  13. <div class="modal-header">
  14. <h5 class="modal-title">Modal title</h5>
  15. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  16. </div>
  17. <div class="modal-body">
  18. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Adipisci animi beatae delectus deleniti dolorem eveniet facere fuga iste nemo nesciunt nihil odio perspiciatis, quia quis reprehenderit sit tempora totam unde.
  19. </div>
  20. <div class="modal-footer">
  21. <button type="button" class="btn me-auto" data-bs-dismiss="modal">Close</button>
  22. <button type="button" class="btn btn-primary" data-bs-dismiss="modal">Save changes</button>
  23. </div>
  24. </div>
  25. </div>
  26. </div>
  27. ```
  28. ## Prompt and alert
  29. ```html example code centered height="30rem"
  30. <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal">
  31. Launch alert modal
  32. </button>
  33. <div class="modal" id="exampleModal" tabindex="-1">
  34. <div class="modal-dialog modal-sm" role="document">
  35. <div class="modal-content">
  36. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  37. <div class="modal-status bg-danger"></div>
  38. <div class="modal-body text-center py-4">
  39. <svg xmlns="http://www.w3.org/2000/svg" class="icon mb-2 text-danger icon-lg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  40. <path stroke="none" d="M0 0h24v24H0z" fill="none" />
  41. <path d="M12 9v2m0 4v.01" />
  42. <path d="M5 19h14a2 2 0 0 0 1.84 -2.75l-7.1 -12.25a2 2 0 0 0 -3.5 0l-7.1 12.25a2 2 0 0 0 1.75 2.75" />
  43. </svg>
  44. <h3>Are you sure?</h3>
  45. <div class="text-secondary">Do you really want to remove 84 files? What you've done cannot be undone.</div>
  46. </div>
  47. <div class="modal-footer">
  48. <div class="w-100">
  49. <div class="row">
  50. <div class="col"><a href="#" class="btn w-100" data-bs-dismiss="modal">
  51. Cancel
  52. </a></div>
  53. <div class="col"><a href="#" class="btn btn-danger w-100" data-bs-dismiss="modal">
  54. Delete 84 items
  55. </a></div>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. ```
  63. ```html example code centered height="30rem"
  64. <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal">
  65. Launch demo modal
  66. </button>
  67. <div class="modal" id="exampleModal" tabindex="-1">
  68. <div class="modal-dialog modal-sm" role="document">
  69. <div class="modal-content">
  70. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  71. <div class="modal-status bg-success"></div>
  72. <div class="modal-body text-center py-4">
  73. <svg xmlns="http://www.w3.org/2000/svg" class="icon mb-2 text-green icon-lg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  74. <path stroke="none" d="M0 0h24v24H0z" fill="none" />
  75. <circle cx="12" cy="12" r="9" />
  76. <path d="M9 12l2 2l4 -4" />
  77. </svg>
  78. <h3>Payment succedeed</h3>
  79. <div class="text-secondary">Your payment of $290 has been successfully submitted. Your invoice has been sent to support@tabler.io.</div>
  80. </div>
  81. <div class="modal-footer">
  82. <div class="w-100">
  83. <div class="row">
  84. <div class="col">
  85. <a href="#" class="btn w-100" data-bs-dismiss="modal">
  86. Go to dashboard
  87. </a>
  88. </div>
  89. <div class="col">
  90. <a href="#" class="btn btn-success w-100" data-bs-dismiss="modal">
  91. View invoice
  92. </a>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. </div>
  98. </div>
  99. </div>
  100. ```
  101. ## Modal with form
  102. ```html example code centered height="30rem"
  103. <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal">
  104. Launch modal with form
  105. </button>
  106. <div class="modal" id="exampleModal" tabindex="-1">
  107. <div class="modal-dialog modal-lg" role="document">
  108. <div class="modal-content">
  109. <div class="modal-header">
  110. <h5 class="modal-title">New report</h5>
  111. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  112. </div>
  113. <div class="modal-body">
  114. <div class="mb-3">
  115. <label class="form-label">Name</label>
  116. <input type="text" class="form-control" name="example-text-input" placeholder="Your report name" />
  117. </div>
  118. <label class="form-label">Report type</label>
  119. <div class="form-selectgroup-boxes row mb-3">
  120. <div class="col-md-6">
  121. <label class="form-selectgroup-item">
  122. <input type="radio" name="report-type" value="1" class="form-selectgroup-input" checked />
  123. <span class="form-selectgroup-label d-flex align-items-center p-3">
  124. <span class="me-3">
  125. <span class="form-selectgroup-check"></span>
  126. </span>
  127. <span class="form-selectgroup-label-content">
  128. <span class="form-selectgroup-title strong mb-1">Simple</span>
  129. <span class="d-block text-secondary">Provide only basic data needed for the report</span>
  130. </span>
  131. </span>
  132. </label>
  133. </div>
  134. <div class="col-md-6">
  135. <label class="form-selectgroup-item">
  136. <input type="radio" name="report-type" value="1" class="form-selectgroup-input" />
  137. <span class="form-selectgroup-label d-flex align-items-center p-3">
  138. <span class="me-3">
  139. <span class="form-selectgroup-check"></span>
  140. </span>
  141. <span class="form-selectgroup-label-content">
  142. <span class="form-selectgroup-title strong mb-1">Advanced</span>
  143. <span class="d-block text-secondary">Insert charts and additional advanced analyses to be inserted in the report</span>
  144. </span>
  145. </span>
  146. </label>
  147. </div>
  148. </div>
  149. <div class="row">
  150. <div class="col-lg-8">
  151. <div class="mb-3">
  152. <label class="form-label">Report url</label>
  153. <div class="input-group input-group-flat">
  154. <span class="input-group-text">
  155. https://tabler.io/reports/
  156. </span>
  157. <input type="text" class="form-control ps-0" value="report-01" autocomplete="off" />
  158. </div>
  159. </div>
  160. </div>
  161. <div class="col-lg-4">
  162. <div class="mb-3">
  163. <label class="form-label">Visibility</label>
  164. <select class="form-select">
  165. <option value="1" selected>Private</option>
  166. <option value="2">Public</option>
  167. <option value="3">Hidden</option>
  168. </select>
  169. </div>
  170. </div>
  171. </div>
  172. </div>
  173. <div class="modal-body">
  174. <div class="row">
  175. <div class="col-lg-6">
  176. <div class="mb-3">
  177. <label class="form-label">Client name</label>
  178. <input type="text" class="form-control" />
  179. </div>
  180. </div>
  181. <div class="col-lg-6">
  182. <div class="mb-3">
  183. <label class="form-label">Reporting period</label>
  184. <input type="date" class="form-control" />
  185. </div>
  186. </div>
  187. <div class="col-lg-12">
  188. <div>
  189. <label class="form-label">Additional information</label>
  190. <textarea class="form-control" rows="3"></textarea>
  191. </div>
  192. </div>
  193. </div>
  194. </div>
  195. <div class="modal-footer">
  196. <a href="#" class="btn btn-link link-secondary" data-bs-dismiss="modal">
  197. Cancel
  198. </a>
  199. <a href="#" class="btn btn-primary ms-auto" data-bs-dismiss="modal">
  200. <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-plus" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  201. <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
  202. <path d="M12 5l0 14"></path>
  203. <path d="M5 12l14 0"></path>
  204. </svg>
  205. Create new report
  206. </a>
  207. </div>
  208. </div>
  209. </div>
  210. </div>
  211. ```