dropzone.mdx 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. ---
  2. title: Dropzone
  3. libs: dropzone
  4. description: Dropzone is a simple JavaScript library that helps you add file drag and drop functionality to your web forms. It is one of the most popular drag and drop library on the web and is used by millions of people.
  5. ---
  6. ## Default Dropzone
  7. ```html example code vendors height="240px"
  8. <form class="dropzone" id="dropzone-default" action="." autocomplete="off" novalidate>
  9. <div class="fallback">
  10. <input name="file" type="file" />
  11. </div>
  12. </form>
  13. <link href="$TABLER_CDN/dist/libs/dropzone/dist/dropzone.css" rel="stylesheet" />
  14. <script src="$TABLER_CDN/dist/libs/dropzone/dist/dropzone-min.js"></script>
  15. <script>
  16. document.addEventListener("DOMContentLoaded", function() {
  17. new Dropzone("#dropzone-default")
  18. })
  19. </script>
  20. ```
  21. ## Add multiple files
  22. ```html example code vendors height="240px"
  23. <form class="dropzone" id="dropzone-mulitple" action="." autocomplete="off" novalidate>
  24. <div class="fallback">
  25. <input name="file" type="file" multiple />
  26. </div>
  27. </form>
  28. <link href="$TABLER_CDN/dist/libs/dropzone/dist/dropzone.css" rel="stylesheet" />
  29. <script src="$TABLER_CDN/dist/libs/dropzone/dist/dropzone-min.js"></script>
  30. <script>
  31. document.addEventListener("DOMContentLoaded", function() {
  32. new Dropzone("#dropzone-mulitple")
  33. })
  34. </script>
  35. ```
  36. ## Custom Dropzone
  37. ```html example code vendors height="240px"
  38. <form class="dropzone" id="dropzone-custom" action="." autocomplete="off" novalidate>
  39. <div class="fallback">
  40. <input name="file" type="file" />
  41. </div>
  42. <div class="dz-message">
  43. <h3 class="dropzone-msg-title">Your text here</h3>
  44. <span class="dropzone-msg-desc">Your custom description here</span>
  45. </div>
  46. </form>
  47. <link href="$TABLER_CDN/dist/libs/dropzone/dist/dropzone.css" rel="stylesheet" />
  48. <script src="$TABLER_CDN/dist/libs/dropzone/dist/dropzone-min.js"></script>
  49. <script>
  50. document.addEventListener("DOMContentLoaded", function() {
  51. new Dropzone("#dropzone-custom")
  52. })
  53. </script>
  54. ```