Published on

The Ultimate Guide To Help You Make A Free Tailwind CSS Tooltip Component With Tailwind CSS

Free Tailwind CSS Tooltip Component

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 Free Tailwind CSS Tooltip Component ui component

A tailwind tooltip is a brief, informative message that appears when a user interacts with an element. it provides additional information. find more free and premium tailwind css components at www.tailwinduikit.com

Why use Tailwind CSS to make a Free Tailwind CSS Tooltip Component ui component?

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

The preview of Free Tailwind CSS Tooltip Component ui component

Free download of the Free Tailwind CSS Tooltip Component's source code

The source code of Free Tailwind CSS Tooltip Component ui component

<div class="py-10 h-full w-full">
<!--- more free and premium Tailwind CSS components at https://tailwinduikit.com/ --->

              <div class="container mx-auto px-6 flex flex-col items-start pl-12 md:pl-0 md:items-center">
                  <div class="h-0 md:h-12"></div>
                  <dh-component>
                      <div class="flex-col md:flex-row flex items-center md:justify-center">
                          <!--Code Block for white tooltip starts-->
                          <a tabindex="0" role="link" aria-label="tooltip 1" class="focus:outline-none focus:ring-gray-300 rounded-full focus:ring-offset-2 focus:ring-2 focus:bg-gray-200 relative mt-20 md:mt-0" onmouseover="showTooltip(1)" onfocus="showTooltip(1)" onmouseout="hideTooltip(1)">
                              <div class=" cursor-pointer">
                                  <svg aria-haspopup="true" xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-info-circle" width="25" height="25" viewBox="0 0 24 24" stroke-width="1.5" stroke="#A0AEC0" fill="none" stroke-linecap="round" stroke-linejoin="round">
                                      <path stroke="none" d="M0 0h24v24H0z" />
                                      <circle cx="12" cy="12" r="9" />
                                      <line x1="12" y1="8" x2="12.01" y2="8" />
                                      <polyline points="11 12 12 12 12 16 13 16" />
                                  </svg>
                              </div>
                              <div id="tooltip1" role="tooltip" class="z-20 -mt-20 w-64 absolute transition duration-150 ease-in-out left-0 ml-8 shadow-lg bg-white p-4 rounded">
                                  <svg class="absolute left-0 -ml-2 bottom-0 top-0 h-full" width="9px" height="16px" viewBox="0 0 9 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
                                      <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
                                          <g id="Tooltips-" transform="translate(-874.000000, -1029.000000)" fill="#FFFFFF">
                                              <g id="Group-3-Copy-16" transform="translate(850.000000, 975.000000)">
                                                  <g id="Group-2" transform="translate(24.000000, 0.000000)">
                                                      <polygon id="Triangle" transform="translate(4.500000, 62.000000) rotate(-90.000000) translate(-4.500000, -62.000000) " points="4.5 57.5 12.5 66.5 -3.5 66.5"></polygon>
                                                  </g>
                                              </g>
                                          </g>
                                      </g>
                                  </svg>
                                  <p class="text-sm font-bold text-gray-800 pb-1">Keep track of follow ups</p>
                                  <p class="text-xs leading-4 text-gray-600 pb-3">Reach out to more prospects at the right moment.</p>
                                  <div class="flex justify-between">
                                      <div class="flex items-center">
                                          <span class="text-xs font-bold text-indigo-700">Step 1 of 4</span>
                                      </div>
                                      <div class="flex items-center">
                                          <button class="focus:outline-none  focus:text-gray-400 text-xs text-gray-600 underline mr-2 cursor-pointer">Skip Tour</button>
                                          <button onblur="hideTooltip(1)" class="focus:ring-2 focus:ring-offset-2 focus:ring-indigo-700 focus:bg-indigo-400 focus:outline-none bg-indigo-700 transition duration-150 ease-in-out hover:bg-indigo-600 rounded text-white px-5 py-1 text-xs">Next</button>
                                      </div>
                                  </div>
                              </div>
                          </a>
                          <!--Code Block for white tooltip ends-->
  
                          <!--Code Block for indigo tooltip starts-->
                          <a  tabindex="0" role="link" aria-label="tooltip 2" class="focus:outline-none focus:ring-gray-300 rounded-full focus:ring-offset-2 focus:ring-2 focus:bg-gray-200 relative my-28 md:my-0 md:mx-64" onmouseover="showTooltip(2)" onfocus="showTooltip(2)" onmouseout="hideTooltip(2)">
                              <div class=" cursor-pointer">
                                  <svg aria-haspopup="true" xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-info-circle" width="25" height="25" viewBox="0 0 24 24" stroke-width="1.5" stroke="#A0AEC0" fill="none" stroke-linecap="round" stroke-linejoin="round">
                                      <path stroke="none" d="M0 0h24v24H0z" />
                                      <circle cx="12" cy="12" r="9" />
                                      <line x1="12" y1="8" x2="12.01" y2="8" />
                                      <polyline points="11 12 12 12 12 16 13 16" />
                                  </svg>
                              </div>
                              <div id="tooltip2" role="tooltip" class="z-20 -mt-20 w-64 absolute transition duration-150 ease-in-out left-0 ml-8 shadow-lg bg-indigo-700 p-4 rounded">
                                  <svg class="absolute left-0 -ml-2 bottom-0 top-0 h-full" width="9px" height="16px" viewBox="0 0 9 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
                                      <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
                                          <g id="Tooltips-" transform="translate(-874.000000, -1029.000000)" fill="#4c51bf">
                                              <g id="Group-3-Copy-16" transform="translate(850.000000, 975.000000)">
                                                  <g id="Group-2" transform="translate(24.000000, 0.000000)">
                                                      <polygon id="Triangle" transform="translate(4.500000, 62.000000) rotate(-90.000000) translate(-4.500000, -62.000000) " points="4.5 57.5 12.5 66.5 -3.5 66.5"></polygon>
                                                  </g>
                                              </g>
                                          </g>
                                      </g>
                                  </svg>
                                  <p class="text-sm font-bold text-white pb-1">Keep track of follow ups</p>
                                  <p class="text-xs leading-4 text-white pb-3">Reach out to more prospects at the right moment.</p>
                                  <div class="flex justify-between">
                                      <div class="flex items-center">
                                          <span class="text-xs font-bold text-white">Step 1 of 4</span>
                                      </div>
                                      <div class="flex items-center">
                                          <button class="focus:outline-none focus:underline focus:text-indigo-200 text-xs text-white underline mr-2 cursor-pointer">Skip Tour</button>
                                          <button onblur="hideTooltip(2)" class="focus:ring-2 focus:ring-offset-2 focus:ring-indigo-700 focus:bg-indigo-400 focus:outline-none focus:text-white bg-white transition duration-150 ease-in-out focus:outline-none hover:bg-gray-200 rounded text-indigo-700 px-5 py-1 text-xs">Next</button>
                                      </div>
                                  </div>
                              </div>
                          </a>
                          <!--Code Block for indigo tooltip ends-->
  
                          <!--Code Block for gray tooltip starts-->
                          <a tabindex="0" aria-label="tooltip 3" role="link" class="focus:outline-none focus:ring-gray-300 rounded-full focus:ring-offset-2 focus:ring-2 focus:bg-gray-200 relative" onmouseover="showTooltip(3)" onfocus="showTooltip(3)" onmouseout="hideTooltip(3)">
                              <div class=" cursor-pointer">
                                  <svg aria-haspopup="true" xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-info-circle" width="25" height="25" viewBox="0 0 24 24" stroke-width="1.5" stroke="#A0AEC0" fill="none" stroke-linecap="round" stroke-linejoin="round">
                                      <path stroke="none" d="M0 0h24v24H0z" />
                                      <circle cx="12" cy="12" r="9" />
                                      <line x1="12" y1="8" x2="12.01" y2="8" />
                                      <polyline points="11 12 12 12 12 16 13 16" />
                                  </svg>
                              </div>
                              <div id="tooltip3" role="tooltip" class="z-20 -mt-20 w-64 absolute transition duration-150 ease-in-out left-0 ml-8 shadow-lg bg-gray-800 p-4 rounded">
                                  <svg class="absolute left-0 -ml-2 bottom-0 top-0 h-full" width="9px" height="16px" viewBox="0 0 9 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
                                      <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
                                          <g id="Tooltips-" transform="translate(-874.000000, -1029.000000)" fill="#2D3748">
                                              <g id="Group-3-Copy-16" transform="translate(850.000000, 975.000000)">
                                                  <g id="Group-2" transform="translate(24.000000, 0.000000)">
                                                      <polygon id="Triangle" transform="translate(4.500000, 62.000000) rotate(-90.000000) translate(-4.500000, -62.000000) " points="4.5 57.5 12.5 66.5 -3.5 66.5"></polygon>
                                                  </g>
                                              </g>
                                          </g>
                                      </g>
                                  </svg>
                                  <p class="text-sm font-bold text-white pb-1">Keep track of follow ups</p>
                                  <p class="text-xs leading-4 text-white pb-3">Reach out to more prospects at the right moment.</p>
                                  <div class="flex justify-between">
                                      <div class="flex items-center">
                                          <span class="text-xs font-bold text-white">Step 1 of 4</span>
                                      </div>
                                      <div class="flex items-center">
                                          <button class="focus:outline-none focus:underline focus:text-indigo-200 text-xs text-white underline mr-2 cursor-pointer">Skip Tour</button>
                                          <button onblur="hideTooltip(3)" class="focus:ring-2 focus:ring-offset-2 focus:ring-indigo-700 focus:bg-indigo-400 focus:outline-none focus:text-white bg-white transition duration-150 ease-in-out focus:outline-none hover:bg-gray-200 rounded text-gray-600 px-5 py-1 text-xs">Next</button>
                                      </div>
                                  </div>
                              </div>
                          </a>
                          <!--Code Block for gray tooltip ends-->
                      </div>
                  </dh-component>
                  <div class="h-12"></div>
              </div>
          </div>
          <script src="index.js"></script>
          <script>function showTooltip(flag) {
  switch (flag) {
    case 1:
      document.getElementById("tooltip1").classList.remove("hidden");
      break;
    case 2:
      document.getElementById("tooltip2").classList.remove("hidden");
      break;
    case 3:
      document.getElementById("tooltip3").classList.remove("hidden");
      break;
  }
}
function hideTooltip(flag) {
  switch (flag) {
    case 1:
      document.getElementById("tooltip1").classList.add("hidden");
      break;
    case 2:
      document.getElementById("tooltip2").classList.add("hidden");
      break;
    case 3:
      document.getElementById("tooltip3").classList.add("hidden");
      break;
  }
}
</script>

How to make a Free Tailwind CSS Tooltip Component with Tailwind CSS?

Install tailwind css of verion 2.2.19

Use the script html tag to import the script of Tailwind CSS of the version 2.2.19

<script src="https://cdn.tailwindcss.com"></script>

All the unility class needed to make a Free Tailwind CSS Tooltip Component component

  • py-10
  • h-full
  • w-full
  • mx-auto
  • px-6
  • flex
  • flex-col
  • pl-12
  • md:pl-0
  • h-0
  • md:h-12
  • md:flex-row
  • focus:bg-gray-200
  • relative
  • mt-20
  • md:mt-0
  • z-20
  • -mt-20
  • w-64
  • absolute
  • left-0
  • ml-8
  • bg-white
  • p-4
  • -ml-2
  • bottom-0
  • top-0
  • text-sm
  • text-gray-800
  • pb-1
  • text-xs
  • text-gray-600
  • pb-3
  • text-indigo-700
  • focus:text-gray-400
  • mr-2
  • focus:bg-indigo-400
  • bg-indigo-700
  • hover:bg-indigo-600
  • text-white
  • px-5
  • py-1
  • my-28
  • md:my-0
  • md:mx-64
  • focus:text-indigo-200
  • focus:text-white
  • hover:bg-gray-200
  • bg-gray-800
  • h-12

50 steps to make a Free Tailwind CSS Tooltip Component component with Tailwind CSS

  1. Control the vertical padding of an element to 2.5rem using the py-10 utilities.

  2. Use h-full to set an element’s height to 100% of its parent, as long as the parent has a defined height.

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

  4. Control the horizontal margin of an element to auto using the mx-auto utilities.

  5. Control the horizontal padding of an element to 1.5rem using the px-6 utilities.

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

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

  8. Adjust the left padding of the element to 3rem using the pl-12 utilities class

  9. Adjust the left padding of the element to 0rem at only medium screen sizes using the md:pl-0 utilities class

  10. Use h-0 to set an element to a fixed height(0rem).

  11. Use md:h-12 to set an element to a fixed height(3rem) at only medium screen sizes.

  12. Use flex to create a block-level flex container at only medium screen sizes.

  13. Control the background color of an element to gray-200 using the focus:bg-gray-200 utilities on focus.

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

  15. Control the margin on top side of an element to 5rem using the mt-20 utilities.

  16. Control the margin on top side of an element to 0rem at only medium screen sizes using the md:mt-0 utilities.

  17. Control the stack order (or three-dimensional positioning) of an element to 20 in Tailwind, regardless of order it has been displayed, using the z-20 utilities.

  18. Control the margin on top side of an element to -5rem using the -mt-20 utilities.

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

  20. 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.

  21. Use the left-0 utilities to set the left position of a positioned element to 0rem.

  22. Control the margin on left side of an element to 2rem using the ml-8 utilities.

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

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

  25. Control the margin on left side of an element to -0.5rem using the -ml-2 utilities.

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

  27. Use the top-0 utilities to set the top position of a positioned element to 0rem.

  28. Control the text color of an element to sm using the text-sm utilities.

  29. Control the text color of an element to gray-800 using the text-gray-800 utilities.

  30. Control the padding on bottom side of an element to 0.25rem using the pb-1 utilities.

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

  32. Control the text color of an element to gray-600 using the text-gray-600 utilities.

  33. Control the padding on bottom side of an element to 0.75rem using the pb-3 utilities.

  34. Control the text color of an element to indigo-700 using the text-indigo-700 utilities.

  35. Control the text color of an element to gray-400 on focus using the focus:text-gray-400 utilities.

  36. Control the margin on right side of an element to 0.5rem using the mr-2 utilities.

  37. Control the background color of an element to indigo-400 using the focus:bg-indigo-400 utilities on focus.

  38. Control the background color of an element to indigo-700 using the bg-indigo-700 utilities.

  39. Control the background color of an element to indigo-600 using the hover:bg-indigo-600 utilities on hover.

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

  41. Control the horizontal padding of an element to 1.25rem using the px-5 utilities.

  42. Control the vertical padding of an element to 0.25rem using the py-1 utilities.

  43. Control the vertical margin of an element to 7rem using the my-28 utilities.

  44. Control the vertical margin of an element to 0rem at only medium screen sizes using the md:my-0 utilities.

  45. Control the horizontal margin of an element to 16rem at only medium screen sizes using the md:mx-64 utilities.

  46. Control the text color of an element to indigo-200 on focus using the focus:text-indigo-200 utilities.

  47. Control the text color of an element to white on focus using the focus:text-white utilities.

  48. Control the background color of an element to gray-200 using the hover:bg-gray-200 utilities on hover.

  49. Control the background color of an element to gray-800 using the bg-gray-800 utilities.

  50. Use h-12 to set an element to a fixed height(3rem).

Conclusion

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