Published on

6 Steps To Make A Fb Messenger Clone With Tailwind CSS Like A Pro In Under An Hour

Fb Messenger Clone

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 Fb Messenger Clone ui component

Facebook mesenger chat ui clone.

Why use Tailwind CSS to build a Fb Messenger Clone ui component?

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

The preview of Fb Messenger Clone ui component

Free download of the Fb Messenger Clone's source code

The source code of Fb Messenger Clone ui component

<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- This is an example component -->
<div class="flex flex-col h-screen w-screen bg-white">
  <div id="chat"  class="flex flex-col mt-2 flex-col-reverse overflow-y-scroll	 space-y-3 mb-20 pb-3 ">
    
    <div class="w-max ml-auto break-all mt-2 mb-1 p-2 rounded-br-none bg-blue-500 rounded-2xl text-white text-left mr-5">
      2/10
    </div>
    <div class="w-max ml-auto break-all mt-2 mb-1 p-2 rounded-br-none bg-blue-500 rounded-2xl text-white text-left mr-5">
      But numbers can
    </div>
    <div class="other break-all mt-2  ml-5 rounded-bl-none float-none bg-gray-300 mr-auto rounded-2xl p-2">
      Aww thx!!
    </div>
    <div class="w-max ml-auto break-all mt-2 mb-1 p-2 rounded-br-none bg-blue-500 rounded-2xl text-white text-left mr-5">
      Words can't describe how beautiful you are :)
    </div>
     <div class="other break-all mt-2  ml-5 rounded-bl-none float-none bg-gray-300 mr-auto rounded-2xl p-2">
      Words can't decsribe how ugly you are ;)
    </div>   
  </div>
  <div class="flex flex-row  items-center  bottom-0 my-2 w-full">
    <div
      class="ml-2 flex flex-row border-gray items-center w-full border rounded-3xl h-12 px-2"
    >
      <button
        class="focus:outline-none flex items-center justify-center h-10 w-10 hover:text-red-600 text-red-400 ml-1"
      >
        <svg
          class="w-5 h-5"
          fill="none"
          stroke="currentColor"
          viewBox="0 0 24 24"
          xmlns="http://www.w3.org/2000/svg"
        >
          <path
            stroke-linecap="round"
            stroke-linejoin="round"
            stroke-width="2"
            d="M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7m7 7v4m0 0H8m4 0h4m-4-8a3 3 0 01-3-3V5a3 3 0 116 0v6a3 3 0 01-3 3z"
          ></path>
        </svg>
      </button>
      <div class="w-full">
        <input
          type="text"
          id="message"
          class="border rounded-2xl border-transparent w-full focus:outline-none text-sm h-10 flex items-center"
          placeholder="Type your message...."
        />
      </div>
      <div class="flex flex-row">
        <button class="focus:outline-none flex items-center justify-center h-10 w-8 hover:text-blue-600  text-blue-400">
          <svg
            class="w-5 h-5 "
            fill="none"
            stroke="currentColor"
            viewBox="0 0 24 24"
            xmlns="http://www.w3.org/2000/svg"
          >
            <path
              stroke-linecap="round"
              stroke-linejoin="round"
              stroke-width="2"
              d="M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13"
            ></path>
          </svg>
        </button>
        <button
          id="capture"      
          class="focus:outline-none flex items-center justify-center h-10 w-8 hover:text-green-600 text-green-400 ml-1 mr-2"
        >
          <svg
            class="w-5 h-5"
            fill="none"
            stroke="currentColor"
            viewBox="0 0 24 24"
            xmlns="http://www.w3.org/2000/svg"
          >
            <path
              stroke-linecap="round"
              stroke-linejoin="round"
              stroke-width="2"
              d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"
            ></path>
          </svg>
        </button>
      </div>
    </div>
    <div class="ml-3 mr-2">
      <button
         id="other"
        class="flex items-center justify-center h-10 w-10 rounded-full bg-gray-200 hover:bg-gray-300 text-indigo-800 text-white focus:outline-none"
      >
        <svg
          class="w-5 h-5 transform -rotate-90 -mr-px"
          fill="none"
          stroke="currentColor"
          viewBox="0 0 24 24"
          xmlns="http://www.w3.org/2000/svg"
        >
          <path
            stroke-linecap="round"
            stroke-linejoin="round"
            stroke-width="2"
            d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"
          ></path>
        </svg>
      </button>
      
    </div>
    <div>
        <button
         id="self"
        class="flex items-center justify-center h-10 w-10 mr-2 rounded-full bg-gray-200 hover:bg-gray-300 text-indigo-800 text-white focus:outline-none"
      >
        <svg
          class="w-5 h-5 transform rotate-90 -mr-px"
          fill="none"
          stroke="currentColor"
          viewBox="0 0 24 24"
          xmlns="http://www.w3.org/2000/svg"
        >
          <path
            stroke-linecap="round"
            stroke-linejoin="round"
            stroke-width="2"
            d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"
          ></path>
        </svg>
      </button>
    </div>
  </div>
</div>

How to build a Fb Messenger Clone with Tailwind CSS?

Install tailwind css of verion 2.0.2

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

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

All the unility class needed to build a Fb Messenger Clone component

  • flex
  • flex-col
  • h-screen
  • w-screen
  • bg-white
  • mt-2
  • flex-col-reverse
  • mb-20
  • pb-3
  • w-max
  • ml-auto
  • mb-1
  • p-2
  • bg-blue-500
  • text-white
  • text-left
  • mr-5
  • ml-5
  • float-none
  • bg-gray-300
  • mr-auto
  • flex-row
  • bottom-0
  • my-2
  • w-full
  • ml-2
  • border-gray
  • h-12
  • px-2
  • h-10
  • w-10
  • hover:text-red-600
  • text-red-400
  • ml-1
  • w-5
  • h-5
  • border-transparent
  • text-sm
  • w-8
  • hover:text-blue-600
  • text-blue-400
  • hover:text-green-600
  • text-green-400
  • mr-2
  • ml-3
  • bg-gray-200
  • hover:bg-gray-300
  • text-indigo-800
  • -mr-px

49 steps to build a Fb Messenger Clone component with Tailwind CSS

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

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

  3. Use h-screen to make an element span the entire height of the viewport.

  4. Use w-screen to make an element span the entire width of the viewport.

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

  6. Control the margin on top side of an element to 0.5rem using the mt-2 utilities.

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

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

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

  10. Use w-max to set an element to a fixed width(max).

  11. Control the margin on left side of an element to auto using the ml-auto utilities.

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

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

  14. Control the background color of an element to blue-500 using the bg-blue-500 utilities.

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

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

  17. Control the margin on right side of an element to 1.25rem using the mr-5 utilities.

  18. Control the margin on left side of an element to 1.25rem using the ml-5 utilities.

  19. Use float-none to reset any floats that are applied to an element. This is the default value for the float property.

  20. Control the background color of an element to gray-300 using the bg-gray-300 utilities.

  21. Control the margin on right side of an element to auto using the mr-auto utilities.

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

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

  24. Control the vertical margin of an element to 0.5rem using the my-2 utilities.

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

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

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

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

  29. Control the horizontal padding of an element to 0.5rem using the px-2 utilities.

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

  31. Use w-10 to set an element to a fixed width(2.5rem).

  32. Control the text color of an element to red-600 on hover using the hover:text-red-600 utilities.

  33. Control the text color of an element to red-400 using the text-red-400 utilities.

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

  35. Use w-5 to set an element to a fixed width(1.25rem).

  36. Use h-5 to set an element to a fixed height(1.25rem).

  37. Control the border color of an element to transparent using the border-transparent utilities.

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

  39. Use w-8 to set an element to a fixed width(2rem).

  40. Control the text color of an element to blue-600 on hover using the hover:text-blue-600 utilities.

  41. Control the text color of an element to blue-400 using the text-blue-400 utilities.

  42. Control the text color of an element to green-600 on hover using the hover:text-green-600 utilities.

  43. Control the text color of an element to green-400 using the text-green-400 utilities.

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

  45. Control the margin on left side of an element to 0.75rem using the ml-3 utilities.

  46. Control the background color of an element to gray-200 using the bg-gray-200 utilities.

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

  48. Control the text color of an element to indigo-800 using the text-indigo-800 utilities.

  49. Control the margin on right side of an element to px using the -mr-px utilities.

Conclusion

The above is a step-by-step tutorial on how to use Tailwind CSS to build a Fb Messenger Clone components, learn and follow along to implement your own components.