Published on

3 Things You Must Know To Make A Notifications Popup With Tailwind CSS

Tags
Notifications popup

What is Tailwind CSS?

Tailwind CSS is a utility-first CSS framework that focuses on creating personalized user interfaces quickly. It can gives you all the building blocks you are able to create personalized designs without having to fight to override irritating opinionated styles. Also, Tailwind CSS is a highly configurable, low-level CSS framework.

The description of Notifications popup ui component

A notifications popup for tailwind ccss

Why use Tailwind CSS to make a Notifications popup ui component?

  • It can make the building process of Notifications popup ui component faster and more easily.
  • Enables building complex responsive layouts and components freely.
  • Minimum lines of CSS code in Notifications popup component file.

The preview of Notifications popup ui component

Free download of the Notifications popup's source code

The source code of Notifications popup ui component

<div>
  <div class="pr-16 relative">
    <div class="bg-white rounded-lg shadow-md p-4 border-1 border-gray-400 w-64 mb-8">
      <div class="relative">
        <span class="block absolute bottom-0 shadow-md w-3 h-3 right-0" style="right:-30px;background-color: inherit; transform: translateX(-6px) rotate(45deg); pointer-events: none; box-shadow: 2px -2px 5px 0 rgba(0,0,0,.1);">&nbsp;</span>
        <p class="block mb-1 text-gray-900 leading-tight mb-4">
          ¿Te gustaría recibir notificaciones de nuestro sitio web?
        </p>
        <div class="block flex flex-wrap w-full">
          <button class="rounded-l justify-center p-2 text-xs font-bold bg-green-500 text-white flex w-1/2">SI</button>
          <button class="rounded-r justify-center p-2 text-xs bg-red-500 text-white  flex w-1/2">No</button>
        </div>
      </div>
    </div>
    <div class="absolute bottom-0 shadow-md right-0 mr-0 mb-4 bg-white rounded">
      <p class="absolute bg-red-600 justify-center rounded-full px-1 mr-4 text-white text-xs">5</p>
      <svg class="w-12 ml-1" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg"><path d="m9 8a1 1 0 0 0 1-1v-3a1 1 0 0 0 -2 0v3a1 1 0 0 0 1 1z" fill="#7ab92d"/><path d="m7 17.82h4a.82.82 0 0 0 0-1.64h-1.18v-2.18a.82.82 0 0 0 -1.64 0v2.18h-1.18a.82.82 0 0 0 0 1.64z" fill="#7ab92d"/><path d="m58 38h-6a1 1 0 0 0 -1 1v4a1 1 0 0 0 2 0v-3h4v3a1 1 0 0 0 2 0v-4a1 1 0 0 0 -1-1z" fill="#e59730"/><path d="m27 49h10v6h-10z" fill="#656b76"/><path d="m19 31v-4h-8v-6.89a2.07 2.07 0 0 0 -1.66-2.11 2 2 0 0 0 -2.34 2v7a4 4 0 0 0 4 4z" fill="#fcbc04"/><path d="m45 27v4h8v6.89a2.07 2.07 0 0 0 1.66 2.11 2 2 0 0 0 2.34-2v-7a4 4 0 0 0 -4-4z" fill="#fcbc04"/><path d="m32 52a13 13 0 0 1 -13-12l-1.7-21a14.75 14.75 0 0 1 14.7-16 14.75 14.75 0 0 1 14.7 16l-1.7 21a13 13 0 0 1 -13 12z" fill="#d0d8da"/><path d="m38.65 25.52a30.45 30.45 0 0 1 -13.3 0 3 3 0 0 1 -2.35-2.93v-8.18a3 3 0 0 1 2.35-2.93 30.45 30.45 0 0 1 13.3 0 3 3 0 0 1 2.35 2.93v8.18a3 3 0 0 1 -2.35 2.93z" fill="#57b7eb"/><path d="m28.35 22.52a3 3 0 0 1 -2.35-2.93v-8.24l-.65.13a3 3 0 0 0 -2.35 2.93v8.18a3 3 0 0 0 2.35 2.93 30.45 30.45 0 0 0 13.3 0 3 3 0 0 0 2.35-2.87 30.64 30.64 0 0 1 -12.65-.13z" fill="#4891d3"/><path d="m37 47a13 13 0 0 1 -13-12l-1.7-21a14.74 14.74 0 0 1 2.06-8.81 14.75 14.75 0 0 0 -7.06 13.81l1.7 21a13 13 0 0 0 24.33 5.29 12.9 12.9 0 0 1 -6.33 1.71z" fill="#93999a"/><path d="m53 27h-5a2 2 0 0 0 2 2h3a2 2 0 0 1 2 2v4a2 2 0 0 0 2 2v-6a4 4 0 0 0 -4-4z" fill="#f9e109"/><path d="m11 27v-7a2 2 0 0 0 -2 2v5a2 2 0 0 0 2 2h3a2 2 0 0 0 2-2z" fill="#f9e109"/><path d="m49 43h12v12h-12z" fill="#d0d8da"/><path d="m7 10h4v4h-4z" fill="#93999a"/><path d="m7 6h4v4h-4z" fill="#a1d51c"/><path d="m37 34h-3v-3h-4v3h-3v4h3v3h4v-3h3z" fill="#fcbc04"/><path d="m24 55h16v4h-16z" fill="#93999a"/><rect fill="#fcbc04" height="8" rx="3" width="6" x="19" y="53"/><rect fill="#fcbc04" height="8" rx="3" width="6" x="39" y="53"/><path d="m26 55h12a0 0 0 0 1 0 0 2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2-2 0 0 0 0 1 0 0z" fill="#d0d8da"/><path d="m52 46v-3h-3v12h12v-3h-3a6 6 0 0 1 -6-6z" fill="#93999a"/><path d="m9 6h2v4h-2z" fill="#c4f236"/><path d="m9 10h2a0 0 0 0 1 0 0v2a0 0 0 0 1 0 0 2 2 0 0 1 -2-2 0 0 0 0 1 0 0z" fill="#d0d8da"/><path d="m42 53a3 3 0 0 1 3 3v2a0 0 0 0 1 0 0 3 3 0 0 1 -3-3v-2a0 0 0 0 1 0 0z" fill="#f9e109"/><path d="m22 53a3 3 0 0 1 3 3v2a0 0 0 0 1 0 0 3 3 0 0 1 -3-3v-2a0 0 0 0 1 0 0z" fill="#f9e109"/><path d="m37 15h-2a1 1 0 0 0 0 2h2a1 1 0 0 0 0-2z" fill="#c4f236"/><path d="m30 16a1 1 0 0 0 -1-1h-2a1 1 0 0 0 0 2h2a1 1 0 0 0 1-1z" fill="#c4f236"/><path d="m33.41 19.41a2 2 0 0 1 -2.82 0 1 1 0 0 0 -1.42 1.42 4 4 0 0 0 5.66 0 1 1 0 1 0 -1.42-1.42z" fill="#c4f236"/><path d="m57 48h-1v-1a1 1 0 0 0 -2 0v1h-1a1 1 0 0 0 0 2h1v1a1 1 0 0 0 2 0v-1h1a1 1 0 0 0 0-2z" fill="#f9e109"/><g fill="#e59730"><path d="m49 27h2v4h-2z"/><path d="m53 33h4v2h-4z"/><path d="m13 27h2v4h-2z"/><path d="m7 23h4v2h-4z"/></g><path d="m53 50h.54a6.06 6.06 0 0 1 -1.12-1.8 1 1 0 0 0 .58 1.8z" fill="#fcbc04"/><path d="m55 52a1 1 0 0 0 .8-.42 6.06 6.06 0 0 1 -1.8-1.12v.54a1 1 0 0 0 1 1z" fill="#fcbc04"/><path d="m11 26a1 1 0 0 0 -.71.29l-2.72 2.71a3.89 3.89 0 0 0 1.43 1.43l2.73-2.72a1 1 0 0 0 .27-.71h-1z" fill="#e59730"/><path d="m53 32a1 1 0 0 0 .71-.29l2.72-2.71a3.89 3.89 0 0 0 -1.43-1.43l-2.73 2.72a1 1 0 0 0 -.27.71h1z" fill="#e59730"/><path d="m9 3a1 1 0 0 1 1 1v2a0 0 0 0 1 0 0h-1a0 0 0 0 1 0 0v-3a0 0 0 0 1 0 0z" fill="#a1d51c"/></svg>
    </div>
  </div>
</div>

How to make a Notifications popup with Tailwind CSS?

Install tailwind css of verion 1.2.0

Use the link html tag to import the stylesheet of Tailwind CSS of the version 1.2.0

<link href=https://unpkg.com/[email protected]/dist/tailwind.min.css rel="stylesheet">

All the unility class needed to make a Notifications popup component

  • pr-16
  • relative
  • bg-white
  • p-4
  • border-1
  • border-gray-400
  • w-64
  • mb-8
  • block
  • absolute
  • bottom-0
  • w-3
  • h-3
  • right-0
  • mb-1
  • text-gray-900
  • mb-4
  • flex
  • flex-wrap
  • w-full
  • p-2
  • text-xs
  • bg-green-500
  • text-white
  • w-1/2
  • bg-red-500
  • mr-0
  • bg-red-600
  • px-1
  • mr-4
  • w-12
  • ml-1

32 steps to make a Notifications popup component with Tailwind CSS

  1. Control the padding on right side of an element to 4rem using the pr-16 utilities.

  2. Use relative to position an element according to the normal flow of the document.

  3. Control the background color of an element to white using the bg-white utilities.

  4. Control the padding on all sides of an element to 1rem using the p-4 utilities.

  5. Control the border color of an element to 0.25rem using the border-1 utilities.

  6. Control the border color of an element to gray-400 using the border-gray-400 utilities.

  7. Use w-64 to set an element to a fixed width(16rem).

  8. Control the margin on bottom side of an element to 2rem using the mb-8 utilities.

  9. Use inline utilities to put the element on its own line and fill its parent.

  10. Use absolute to position an element outside of the normal flow of the document, causing neighboring elements to act as if the element doesn’t exist.

  11. Use the bottom-0 utilities to set the bottom position of a positioned element to 0rem.

  12. Use w-3 to set an element to a fixed width(0.75rem).

  13. Use h-3 to set an element to a fixed height(0.75rem).

  14. Use the right-0 utilities to set the right position of a positioned element to 0rem.

  15. Control the margin on bottom side of an element to 0.25rem using the mb-1 utilities.

  16. Control the text color of an element to gray-900 using the text-gray-900 utilities.

  17. Control the margin on bottom side of an element to 1rem using the mb-4 utilities.

  18. Use flex to create a block-level flex container.

  19. Use flex to create a block-level flex container.

  20. Use w-full to set an element to a 100% based width.

  21. Control the padding on all sides of an element to 0.5rem using the p-2 utilities.

  22. Control the text color of an element to xs using the text-xs utilities.

  23. Control the background color of an element to green-500 using the bg-green-500 utilities.

  24. Control the text color of an element to white using the text-white utilities.

  25. Use w-1/2 to set an element to a fixed width(1/2).

  26. Control the background color of an element to red-500 using the bg-red-500 utilities.

  27. Control the margin on right side of an element to 0rem using the mr-0 utilities.

  28. Control the background color of an element to red-600 using the bg-red-600 utilities.

  29. Control the horizontal padding of an element to 0.25rem using the px-1 utilities.

  30. Control the margin on right side of an element to 1rem using the mr-4 utilities.

  31. Use w-12 to set an element to a fixed width(3rem).

  32. Control the margin on left side of an element to 0.25rem using the ml-1 utilities.

Conclusion

The above is a step-by-step tutorial on how to use Tailwind CSS to make a Notifications popup components, learn and follow along to implement your own components.