Published on

3 Things You Must Know To Create A Instagram Direct Clone With Tailwind CSS

Tags
Instagram Direct 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 Instagram Direct Clone ui component

Instagram direct clone by mehdi neysi

Why use Tailwind CSS to create a Instagram Direct Clone ui component?

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

The preview of Instagram Direct Clone ui component

Free download of the Instagram Direct Clone's source code

The source code of Instagram Direct Clone ui component

<div class="bg-gray-50 w-screen h-screen sm:p-5">
  <div class="bg-white border border-gray-200 rounded flex h-full">
    <!-- Left -->
    <div class="w-full sm:w-1/2 md:w-1/3 lg:w-1/4 h-full">
      <!-- Account -->
      <div class="border-b border-gray-200 p-3 relative">
        <button class="flex items-center mx-auto select-none font-semibold focus:outline-none">
          neysidev
          <svg class="ml-1 transform rotate-180 translate-y-0.5" height="20" viewBox="0 0 48 48" width="20">
            <path d="M40 33.5c-.4 0-.8-.1-1.1-.4L24 18.1l-14.9 15c-.6.6-1.5.6-2.1 0s-.6-1.5 0-2.1l16-16c.6-.6 1.5-.6 2.1 0l16 16c.6.6.6 1.5 0 2.1-.3.3-.7.4-1.1.4z"></path>
          </svg>
        </button>
        <button class="absolute right-3 top-1/2 transform -translate-y-1/2 focus:outline-none">
          <svg height="20" viewBox="0 0 44 44" width="20">
            <path d="M33.7 44.12H8.5a8.41 8.41 0 01-8.5-8.5v-25.2a8.41 8.41 0 018.5-8.5H23a1.5 1.5 0 010 3H8.5a5.45 5.45 0 00-5.5 5.5v25.2a5.45 5.45 0 005.5 5.5h25.2a5.45 5.45 0 005.5-5.5v-14.5a1.5 1.5 0 013 0v14.5a8.41 8.41 0 01-8.5 8.5z"></path><path d="M17.5 34.82h-6.7a1.5 1.5 0 01-1.5-1.5v-6.7a1.5 1.5 0 01.44-1.06L34.1 1.26a4.45 4.45 0 016.22 0l2.5 2.5a4.45 4.45 0 010 6.22l-24.3 24.4a1.5 1.5 0 01-1.02.44zm-5.2-3h4.58l23.86-24a1.45 1.45 0 000-2l-2.5-2.5a1.45 1.45 0 00-2 0l-24 23.86z"></path><path d="M38.2 14.02a1.51 1.51 0 01-1.1-.44l-6.56-6.56a1.5 1.5 0 012.12-2.12l6.6 6.6a1.49 1.49 0 010 2.12 1.51 1.51 0 01-1.06.4z"></path>
          </svg>
        </button>
      </div>
      <!-- Group -->
      <div class="flex items-center justify-between text-sm border-b border-gray-200">
        <div>
          <button class="py-3 w-20 uppercase font-semibold select-none h-full focus:outline-none border-b border-black">
            Primary
          </button>
          <button class="py-3 w-20 uppercase text-gray-400 select-none h-full focus:outline-none border-b border-transparent">
            General
          </button>
        </div>
        <button class="p-3 font-semibold text-blue-500 select-none h-full focus:outline-none border-b border-transparent">
          1 Request
        </button>
      </div>
      <!-- Chats -->
      <ul class="py-1 overflow-auto">
        <!-- Chat 1 -->
        <li>
          <button class="flex items-center w-full px-4 py-2 select-none hover:bg-gray-100 focus:outline-none">
            <img class="w-12 mr-3 rounded-full border" src="https://i.ibb.co/0ZDqmDs/142030673-447983159572512-6561194794076636819-n.jpg" alt="Junior Coders" />
            <div class="transform translate-y-0.5 text-left">
              <h3 class="leading-4">junior.coders</h3>
              <span class="text-xs text-gray-500">Active 20s ago</span>
            </div>
          </button>
        </li>
        <!-- Chat 2 -->
        <li>
          <button class="flex items-center w-full px-4 py-2 select-none hover:bg-gray-100 focus:outline-none">
            <img class="w-12 mr-3 rounded-full border" src="https://i.ibb.co/n8D3NYv/107410209-890400198133639-1048997058040173171-n.jpg" alt="Tabaghe 16" />
            <div class="transform translate-y-0.5 text-left">
              <h3 class="leading-4">tabaghe16</h3>
              <span class="text-xs text-gray-500">Active 6h ago</span>
            </div>
          </button>
        </li>
        <!-- Chat 3 -->
        <li>
          <button class="flex items-center w-full px-4 py-2 select-none hover:bg-gray-100 focus:outline-none">
            <img class="w-12 mr-3 rounded-full border" src="https://i.ibb.co/bPb39qC/146062600-790305448495619-4399071814928120955-n.jpg" alt="MegaCoders" />
            <div class="transform translate-y-0.5 text-left">
              <h3 class="leading-4">megacoders</h3>
              <span class="text-xs text-gray-500">Active 15min ago</span>
            </div>
          </button>
        </li>
        <!-- Chat 4 -->
        <li>
          <button class="flex items-center w-full px-4 py-2 select-none hover:bg-gray-100 focus:outline-none">
            <img class="w-12 mr-3 rounded-full border" src="https://i.ibb.co/Y7H2b8s/83915635-1271088396614888-3530566050498215936-n.jpg" alt="Graphhit" />
            <div class="transform translate-y-0.5 text-left">
              <h3 class="leading-4">graphhit.ir</h3>
              <span class="text-xs text-gray-500">Active 8h ago</span>
            </div>
          </button>
        </li>
        <!-- Chat 5 -->
        <li>
          <button class="flex items-center w-full px-4 py-2 select-none hover:bg-gray-100 focus:outline-none">
            <img class="w-12 mr-3 rounded-full border" src="https://i.ibb.co/5RTNZzq/120597858-373955600298386-171038155143224317-n.jpg" alt="Dex Design" />
            <div class="transform translate-y-0.5 text-left">
              <h3 class="leading-4">dex.design</h3>
              <span class="text-xs text-gray-500">Active 30min ago</span>
            </div>
          </button>
        </li>
        <!-- Chat 6 -->
        <li>
          <button class="flex items-center w-full px-4 py-2 select-none hover:bg-gray-100 focus:outline-none">
            <img class="w-12 mr-3 rounded-full border" src="https://i.ibb.co/PgxfpHJ/135397005-118438206790158-4813733027837640666-n.jpg" alt="Khoshbakhti" />
            <div class="transform translate-y-0.5 text-left">
              <h3 class="leading-4">khoshbakhti_official</h3>
              <span class="text-xs text-gray-500">Active Yesterday</span>
            </div>
          </button>
        </li>
      </ul>
    </div>
    <!-- Right -->
    <div class="hidden sm:w-1/2 md:w-2/3 lg:w-3/4 border-l border-gray-200 sm:flex items-center justify-center text-center">
      <div class="space-y-5">
        <div class="border border-black rounded-full inline-flex p-5 items-center justify-center">
          <svg class="transform translate-y-1" height="52" viewBox="0 0 48 48" width="52">
            <path d="M47.8 3.8c-.3-.5-.8-.8-1.3-.8h-45C.9 3.1.3 3.5.1 4S0 5.2.4 5.7l13.2 13c.5.4 1.1.6 1.7.3l16.6-8c.7-.3 1.6-.1 2 .5.4.7.2 1.6-.5 2l-15.6 9.9c-.5.3-.8 1-.7 1.6l4.6 19c.1.6.6 1 1.2 1.1h.2c.5 0 1-.3 1.3-.7l23.2-39c.5-.5.5-1.1.2-1.6z"></path>
          </svg>
        </div>
        <div class="space-y-0.5">
          <h1 class="font-semibold text-xl">Your Messages</h1>
          <p class="text-gray-600 min-w-46">Send private photos and messages to a friend or group</p>
        </div>
        <button class="bg-blue-500 py-1 px-3 rounded text-white select-none focus:outline-none">Send Message</button>
      </div>
    </div>
  </div>
</div>

How to create a Instagram Direct Clone 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 Instagram Direct Clone component

  • bg-gray-50
  • w-screen
  • h-screen
  • sm:p-5
  • bg-white
  • border-gray-200
  • flex
  • h-full
  • w-full
  • sm:w-1/2
  • md:w-1/3
  • lg:w-1/4
  • border-b
  • p-3
  • relative
  • mx-auto
  • ml-1
  • absolute
  • right-3
  • top-1/2
  • text-sm
  • py-3
  • w-20
  • border-black
  • text-gray-400
  • border-transparent
  • text-blue-500
  • py-1
  • overflow-auto
  • px-4
  • py-2
  • hover:bg-gray-100
  • w-12
  • mr-3
  • text-left
  • text-xs
  • text-gray-500
  • hidden
  • md:w-2/3
  • lg:w-3/4
  • border-l
  • sm:flex
  • text-center
  • inline-flex
  • p-5
  • text-xl
  • text-gray-600
  • min-w-46
  • bg-blue-500
  • px-3
  • text-white

51 steps to create a Instagram Direct Clone component with Tailwind CSS

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

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

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

  4. Control the padding on all sides of an element to 1.25rem at only small screen sizes using the sm:p-5 utilities.

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

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

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

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

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

  10. Use sm:w-1/2 to set an element to a fixed width(1/2) at only small screen sizes.

  11. Use md:w-1/3 to set an element to a fixed width(1/3) at only medium screen sizes.

  12. Use lg:w-1/4 to set an element to a fixed width(1/4) at only large screen sizes.

  13. Control the border color of an element to b using the border-b utilities.

  14. Control the padding on all sides of an element to 0.75rem using the p-3 utilities.

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

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

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

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

  19. Use the right-3 utilities to set the right position of a positioned element to 0.75rem.

  20. Use the top-1/2 utilities to set the top position of a positioned element to 1/2.

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

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

  23. Use w-20 to set an element to a fixed width(5rem).

  24. Control the border color of an element to black using the border-black utilities.

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

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

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

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

  29. Use overflow-auto to add scrollbars to an element in the event that its content overflows the bounds of that element. Unlike .overflow-scroll, which always shows scrollbars, this utility will only show them if scrolling is necessary.

  30. Control the horizontal padding of an element to 1rem using the px-4 utilities.

  31. Control the vertical padding of an element to 0.5rem using the py-2 utilities.

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

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

  34. Control the margin on right side of an element to 0.75rem using the mr-3 utilities.

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

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

  37. Control the text color of an element to gray-500 using the text-gray-500 utilities.

  38. Use hidden to set an element to display: none and remove it from the page layout.

  39. Use md:w-2/3 to set an element to a fixed width(2/3) at only medium screen sizes.

  40. Use lg:w-3/4 to set an element to a fixed width(3/4) at only large screen sizes.

  41. Control the border color of an element to l using the border-l utilities.

  42. Use flex to create a block-level flex container at only small screen sizes.

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

  44. Use inline-flex to create an inline flex container that flows with text.

  45. Control the padding on all sides of an element to 1.25rem using the p-5 utilities.

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

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

  48. Set the minimum width/height of an element using the min-w-46 utilities.

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

  50. Control the horizontal padding of an element to 0.75rem using the px-3 utilities.

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

Conclusion

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