empty.mdx 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. ---
  2. title: Empty states
  3. description: Empty states or blank pages are commonly used as placeholders for first-use, empty data or error screens. Their aim is to engage users when there is no content to display and that is why their design is extremely important from the point of view of the user experience of your website or app.
  4. ---
  5. ## Default markup
  6. Use the default empty state to engage users in the critical moments of their experience with your website or app. A good empty state screen should let users know what is happening and what they should do next as well as encourage them to take action.
  7. ```html code example
  8. <div class="empty">
  9. <div class="empty-icon">
  10. <svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  11. <path stroke="none" d="M0 0h24v24H0z" fill="none" />
  12. <circle cx="12" cy="12" r="9" />
  13. <line x1="9" y1="10" x2="9.01" y2="10" />
  14. <line x1="15" y1="10" x2="15.01" y2="10" />
  15. <path d="M9.5 15.25a3.5 3.5 0 0 1 5 0" />
  16. </svg>
  17. </div>
  18. <p class="empty-title">No results found</p>
  19. <p class="empty-subtitle text-secondary">
  20. Try adjusting your search or filter to find what you're looking for.
  21. </p>
  22. <div class="empty-action">
  23. <a href="#" class="btn btn-primary">
  24. <svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  25. <path stroke="none" d="M0 0h24v24H0z" fill="none" />
  26. <circle cx="10" cy="10" r="7" />
  27. <line x1="21" y1="21" x2="15" y2="15" />
  28. </svg>
  29. Search again
  30. </a>
  31. </div>
  32. </div>
  33. ```
  34. ## Empty state with illustration
  35. Make your empty state screen more attractive and engaging by adding an illustration. Thanks to a more personalized design, you will improve your brand image and make your website or app more user friendly.
  36. ```html code example
  37. <div class="empty">
  38. <div class="empty-img"><img src="..." height="128" alt="" />
  39. </div>
  40. <p class="empty-title">Invoices are managed from here</p>
  41. <p class="empty-subtitle text-secondary">
  42. Try adjusting your search or filter to find what you're looking for.
  43. </p>
  44. <div class="empty-action">
  45. <a href="#" class="btn btn-primary">
  46. <svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  47. <path stroke="none" d="M0 0h24v24H0z" fill="none" />
  48. <line x1="12" y1="5" x2="12" y2="19" />
  49. <line x1="5" y1="12" x2="19" y2="12" />
  50. </svg>
  51. New invoice
  52. </a>
  53. </div>
  54. </div>
  55. ```
  56. ## Empty state with header
  57. Instead of adding an icon or illustration you can simply give the text:
  58. ```html example
  59. <div class="empty">
  60. <div class="empty-header">404</div>
  61. <p class="empty-title">Oops… You just found an error page</p>
  62. <p class="empty-subtitle text-secondary">
  63. Try adjusting your search or filter to find what you're looking for.
  64. </p>
  65. <div class="empty-action">
  66. <a href="#" class="btn btn-primary">
  67. <svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  68. <path stroke="none" d="M0 0h24v24H0z" fill="none" />
  69. <line x1="5" y1="12" x2="19" y2="12" />
  70. <line x1="5" y1="12" x2="11" y2="18" />
  71. <line x1="5" y1="12" x2="11" y2="6" />
  72. </svg>
  73. Take me home
  74. </a>
  75. </div>
  76. </div>
  77. ```
  78. ```html
  79. <div class="empty">
  80. <div class="empty-header">404</div>
  81. <p class="empty-title">Oops… You just found an error page</p>
  82. <p class="empty-subtitle text-secondary">
  83. Try adjusting your search or filter to find what you're looking for.
  84. </p>
  85. <div class="empty-action">
  86. <a href="#" class="btn btn-primary">
  87. <!-- SVG icon from http://tabler-icons.io/i/arrow-left -->
  88. <svg>...</svg>
  89. Take me home
  90. </a>
  91. </div>
  92. </div>
  93. ```