Published on

The Ninja Guide To How To Build A Intercom Chat UI With Tailwind CSS Better

Tags
Intercom Chat UI

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 Intercom Chat UI ui component

Intercom chat ui

Why use Tailwind CSS to create a Intercom Chat UI ui component?

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

The preview of Intercom Chat UI ui component

Free download of the Intercom Chat UI's source code

The source code of Intercom Chat UI ui component

<div class="bg-white h-screen flex flex-col items-end">
  <div class="flex-1 mt-16 mr-4 w-96 bg-white shadow-xl rounded-lg relative overflow-hidden">
    <div class="bg-blue-700 h-64 rounded-t-lg absolute w-full z-0"></div>
    <div class="flex flex-col overflow-y-auto h-full p-4 space-y-4">
      <div class="flex flex-col z-10 ml-4 text-white">
        <svg class="w-10 h-10 mb-3 -ml-1" 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 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"></path></svg>
        <div class="text-3xl mb-2">Hi Sophie 👋</div>
        <div class="w-60 text-gray-200 text-sm mb-1">We help your business grow by connecting you to your customers.</div>
      </div>
      <div class="border-0 border-t-4 border-blue-500 rounded z-10 shadow-md text-sm">
        <div class="bg-white border border-t-0 rounded-t-none rounded-b flex flex-col space-y-2">
          <div class="px-6 py-4 flex flex-col items-start gap-3">
            <div class="font-semibold ">Start a conversation</div>
            <div class="flex flex-row gap-3">
              <div class="flex flex-row -space-x-10">
                <img class="w-16 h-16 rounded-full border-2 border-white" src="https://images.unsplash.com/photo-1544725176-7c40e5a71c5e?ixlib=rb-1.2.1&ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&auto=format&fit=facearea&w=256&h=256&facepad=2" />
                <img class="w-16 h-16 rounded-full border-2 border-white" src="https://images.unsplash.com/flagged/photo-1570612861542-284f4c12e75f?ixlib=rb-1.2.1&ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&auto=format&fit=facearea&w=256&h=256&facepad=2" />
                <img class="w-16 h-16 rounded-full border-2 border-white" src="https://images.unsplash.com/photo-1499952127939-9bbf5af6c51c?ixlib=rb-1.2.1&ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&auto=format&fit=facearea&w=256&h=256&facepad=2" />
              </div>
              <div class="flex flex-col justify-center">
                <div class="text-gray-400">Our usual reply time</div>
                <div class="flex flex-row items-center gap-1 font-semibold">
                  <svg class="w-4 h-4 text-blue-700" 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 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
                  A few minutes
                </div>
              </div>
            </div>
            <button type="button" class="bg-blue-700 rounded-full text-white flex flex-row gap-2 py-3 px-5">
              <svg class="w-5 h-5 transform rotate-90" 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>
              Send us a message
            </button>
          </div>
          <div class="border-t px-6 py-4">
            <a href="#" class="text-sm text-blue-500 hover:text-blue-300">See all your conversations</a>
          </div>
        </div>
      </div>
      <div class="border-0 border-t-4 border-blue-500 rounded z-10 shadow-md">
        <div class="bg-white border border-t-0 rounded-t-none rounded-b p-6 flex flex-col space-y-2">
          <div class="font-semibold text-sm">Find your answer now</div>
          <div class="flex flex-row">
            <input type="text" placeholder="Search our articles" class="border flex-1 rounded-l p-2 text-sm shadow-inner outline-none bg-gray-50 focus:bg-white">
            <button type="button" class="bg-blue-700 p-2 rounded-r">
              <svg class="w-5 h-5 text-white" 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="M9 5l7 7-7 7"></path></svg>
            </button>
          </div>
        </div>
      </div>
      <div class="bg-white border rounded flex items-center justify-center p-8 z-10">
        this is a card
      </div>
      <div class="bg-white border rounded flex items-center justify-center p-8 z-10">
        this is a card
      </div>
    </div>
    
  </div>
  <div class="bg-blue-600 rounded-full w-16 h-16 m-4 flex items-center justify-center cursor-pointer shadow-xl">
    <svg class="w-6 h-6 text-white" 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 9l-7 7-7-7"></path></svg>
  </div>
</div>

How to create a Intercom Chat UI with Tailwind CSS?

Install tailwind css of verion 2.0.3

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

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

All the unility class needed to create a Intercom Chat UI component

  • bg-white
  • h-screen
  • flex
  • flex-col
  • flex-1
  • mt-16
  • mr-4
  • w-96
  • relative
  • overflow-hidden
  • bg-blue-700
  • h-64
  • absolute
  • w-full
  • z-0
  • overflow-y-auto
  • h-full
  • p-4
  • z-10
  • ml-4
  • text-white
  • w-10
  • h-10
  • mb-3
  • -ml-1
  • text-3xl
  • mb-2
  • w-60
  • text-gray-200
  • text-sm
  • mb-1
  • border-0
  • border-t-4
  • border-blue-500
  • border-t-0
  • px-6
  • py-4
  • gap-3
  • flex-row
  • w-16
  • h-16
  • border-2
  • border-white
  • text-gray-400
  • gap-1
  • w-4
  • h-4
  • text-blue-700
  • gap-2
  • py-3
  • px-5
  • w-5
  • h-5
  • border-t
  • text-blue-500
  • hover:text-blue-300
  • p-6
  • p-2
  • bg-gray-50
  • focus:bg-white
  • p-8
  • bg-blue-600
  • m-4
  • w-6
  • h-6

65 steps to create a Intercom Chat UI component with Tailwind CSS

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

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

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

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

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

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

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

  8. Use w-96 to set an element to a fixed width(24rem).

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

  10. Use overflow-hidden to clip any content within an element that overflows the bounds of that element.

  11. Control the background color of an element to blue-700 using the bg-blue-700 utilities.

  12. Use h-64 to set an element to a fixed height(16rem).

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

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

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

  16. Use overflow-y-auto to allow vertical scrolling if needed.

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

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

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

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

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

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

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

  24. Control the margin on bottom side of an element to 0.75rem using the mb-3 utilities.

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

  26. Control the text color of an element to 3xl using the text-3xl utilities.

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

  28. Use w-60 to set an element to a fixed width(15rem).

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

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

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

  32. Control the border color of an element to 0rem using the border-0 utilities.

  33. Control the border color of an element to t-4 using the border-t-4 utilities.

  34. Control the border color of an element to blue-500 using the border-blue-500 utilities.

  35. Control the border color of an element to t-0 using the border-t-0 utilities.

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

  37. Control the vertical padding of an element to 1rem using the py-4 utilities.

  38. To specify the width between columns, you can use the gap-3 utilities.

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

  40. Use w-16 to set an element to a fixed width(4rem).

  41. Use h-16 to set an element to a fixed height(4rem).

  42. Control the border color of an element to 0.5rem using the border-2 utilities.

  43. Control the border color of an element to white using the border-white utilities.

  44. Control the text color of an element to gray-400 using the text-gray-400 utilities.

  45. To specify the width between columns, you can use the gap-1 utilities.

  46. Use w-4 to set an element to a fixed width(1rem).

  47. Use h-4 to set an element to a fixed height(1rem).

  48. Control the text color of an element to blue-700 using the text-blue-700 utilities.

  49. To specify the width between columns, you can use the gap-2 utilities.

  50. Control the vertical padding of an element to 0.75rem using the py-3 utilities.

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

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

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

  54. Control the border color of an element to t using the border-t utilities.

  55. Control the text color of an element to blue-500 using the text-blue-500 utilities.

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

  57. Control the padding on all sides of an element to 1.5rem using the p-6 utilities.

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

  59. Control the background color of an element to gray-50 using the bg-gray-50 utilities.

  60. Control the background color of an element to white using the focus:bg-white utilities on focus.

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

  62. Control the background color of an element to blue-600 using the bg-blue-600 utilities.

  63. Control the margin on all sides of an element to 1rem using the m-4 utilities.

  64. Use w-6 to set an element to a fixed width(1.5rem).

  65. Use h-6 to set an element to a fixed height(1.5rem).

Conclusion

The above is a step-by-step tutorial on how to use Tailwind CSS to create a Intercom Chat UI components, learn and follow along to implement your own components.