Published on

3 Things You Must Know To Make A Slack clone With Tailwind CSS

Tags
Slack 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 Slack clone ui component

A slack clone for tailwind ccss

Why use Tailwind CSS to build a Slack clone ui component?

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

The preview of Slack clone ui component

Free download of the Slack clone's source code

The source code of Slack clone ui component

<div class="w-full border shadow bg-white">
	<div class="flex">
      	<!-- Sidebar / channel list -->
        <div class="bg-purple-darker text-purple-lighter w-1/5 pb-6 hidden md:block">
            <h1 class="text-white text-xl mb-2 mt-3 px-4 font-sans flex justify-between">
              	<span>Tailwind CSS</span>
              	<svg class="h-6 w-6 text-purple-lightest fill-current" viewBox="0 0 32 32" >
                    <g id="surface1">
                        <path style=" " d="M 16 3 C 14.894531 3 14 3.894531 14 5 C 14 5.085938 14.019531 5.167969 14.03125 5.25 C 10.574219 6.132813 8 9.273438 8 13 L 8 22 C 8 22.566406 7.566406 23 7 23 L 6 23 L 6 25 L 13.1875 25 C 13.074219 25.316406 13 25.648438 13 26 C 13 27.644531 14.355469 29 16 29 C 17.644531 29 19 27.644531 19 26 C 19 25.648438 18.925781 25.316406 18.8125 25 L 26 25 L 26 23 L 25 23 C 24.433594 23 24 22.566406 24 22 L 24 13.28125 C 24 9.523438 21.488281 6.171875 17.96875 5.25 C 17.980469 5.167969 18 5.085938 18 5 C 18 3.894531 17.105469 3 16 3 Z M 15.5625 7 C 15.707031 6.988281 15.851563 7 16 7 C 16.0625 7 16.125 7 16.1875 7 C 19.453125 7.097656 22 9.960938 22 13.28125 L 22 22 C 22 22.351563 22.074219 22.683594 22.1875 23 L 9.8125 23 C 9.925781 22.683594 10 22.351563 10 22 L 10 13 C 10 9.824219 12.445313 7.226563 15.5625 7 Z M 16 25 C 16.5625 25 17 25.4375 17 26 C 17 26.5625 16.5625 27 16 27 C 15.4375 27 15 26.5625 15 26 C 15 25.4375 15.4375 25 16 25 Z "></path>
                    </g>
				</svg>
          	</h1>
          	<div class="flex items-center mb-6 px-4">
          		<span class="bg-green rounded-full block w-2 h-2 mr-2"></span>
              	<span class="text-purple-lightest">Olivia</span>
        	</div>
          	
          	<div class="px-4 mb-2 font-sans">Channels</div>
          	<div class="bg-teal-dark mb-6 py-1 px-4 text-white font-semi-bold "><span class="pr-1 text-grey-light">#</span> general</div>
          	
          	<div class="px-4 mb-3 font-sans">Direct Messages</div>
          
            <div class="flex items-center mb-3 px-4">
                 <span class="bg-green rounded-full block w-2 h-2 mr-2"></span>
                 <span class="text-purple-lightest">Olivia Dunham <i class="text-grey text-sm">(me)</i></span>
          	</div>
          
          
            <div class="flex items-center mb-3 px-4">
                 <span class="bg-green rounded-full block w-2 h-2 mr-2"></span>
                 <span class="text-purple-lightest">Adam Bishop</span>
          	</div>

            <div class="flex items-center px-4 mb-6">
                 <span class="border rounded-full block w-2 h-2 mr-2"></span>
                 <span class="text-purple-lightest">killgt</span>
          	</div>
          
          
          	<div class="px-4 mb-3 font-sans">Applications</div>
          
        </div>
      
      	<!-- Chat content -->
      	<div class="w-full flex flex-col">
          	<!-- Top bar -->
          	<div class="border-b flex px-6 py-2 items-center">
              	<div class="flex flex-col">
                  	<h3 class="text-grey-darkest text-md mb-1 font-extrabold">#general</h3>
                  	<div class="text-grey font-thin text-sm">
                  		Chit-chattin' about ugly HTML and mixing of concerns.
                  	</div>
              	</div>
              	<div class="ml-auto hidden md:block">
                  	<input type="search" placeholder="Search" class="border border-grey rounded-lg p-2"/>
              	</div>
          	</div>
          
			<!-- Chat messages -->
          	<div class="px-6 py-4 flex-1 overflow-scroll-x">
              <!-- A message -->
              	<div class="flex items-start mb-4">
                  	<img src="https://avatars2.githubusercontent.com/u/343407?s=460&v=4" class="w-10 h-10 rounded mr-3" />
                  	<div class="flex flex-col">
                      	<div class="flex items-end">
                      		<span class="font-bold text-md mr-2 font-sans">killgt</span>
                      		<span class="text-grey text-xs font-light">11:46</span>
                      	</div>
                    	<p class="font-light text-md text-grey-darkest pt-1">The slack from the other side.</p>
                  	</div>
              	</div>
              
                <!-- A message -->
              	<div class="flex items-start mb-4">
                  	<img src="https://i.imgur.com/8Km9tLL.jpg" class="w-10 h-10 rounded mr-3" />
                  	<div class="flex flex-col">
                      	<div class="flex items-end">
                      		<span class="font-bold text-md mr-2 font-sans">Olivia Dunham</span>
                      		<span class="text-grey text-xs font-light">12:45</span>
                      	</div>
                    	<p class="font-light text-md text-grey-darkest pt-1">How are we supposed to control the marquee space without an utility for it? I propose this:</p>    
                      	<div class="bg-grey-lighter border border-grey-light font-mono rounded p-3 mt-2 whitespace-pre">.marquee-lightspeed { -webkit-marquee-speed: fast; }
.marquee-lightspeeder { -webkit-marquee-speed: faster; }</div>
                  	</div>
              	</div>
              
                <!-- A message -->
              	<div class="flex items-start">
                  	<img src="https://i.imgur.com/qACoKgY.jpg" class="w-10 h-10 rounded mr-3" />
                  	<div class="flex flex-col">
                      	<div class="flex items-end">
                      		<span class="font-bold text-md mr-2 font-sans">Adam Bishop</span>
                      		<span class="text-grey text-xs font-light">12:46</span>
                      	</div>
                      <p class="font-light text-md text-grey-darkest pt-1"><a href="#" class="text-blue">@Olivia Dunham</a> the size of the generated CSS is creating a singularity in space/time, we must stop adding more utilities before it's too late!</p>    
                  	</div>
              	</div>
              
              	<!-- Ignore -->
              	<br><br><br><br><br><br><br><br><br><br><br>
              
            </div>
          
          	<div class="flex m-6 rounded-lg border-2 border-grey overflow-hidden">
              <span class="text-3xl text-grey px-3 border-r-2 border-grey">+</span>
              <input type="text" class="w-full px-4" placeholder="Message to #general"/>
          	</div>
		</div>
  	</div>
</div>

How to build a Slack clone with Tailwind CSS?

Install tailwind css of verion 0.3.0

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

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

All the unility class needed to build a Slack clone component

  • w-full
  • bg-white
  • flex
  • bg-purple-darker
  • text-purple-lighter
  • w-1/5
  • pb-6
  • hidden
  • md:block
  • text-white
  • text-xl
  • mb-2
  • mt-3
  • px-4
  • h-6
  • w-6
  • text-purple-lightest
  • mb-6
  • bg-green
  • block
  • w-2
  • h-2
  • mr-2
  • bg-teal-dark
  • py-1
  • pr-1
  • text-grey-light
  • mb-3
  • text-grey
  • text-sm
  • flex-col
  • border-b
  • px-6
  • py-2
  • text-grey-darkest
  • text-md
  • mb-1
  • ml-auto
  • border-grey
  • p-2
  • py-4
  • flex-1
  • mb-4
  • w-10
  • h-10
  • mr-3
  • text-xs
  • pt-1
  • bg-grey-lighter
  • border-grey-light
  • p-3
  • mt-2
  • text-blue
  • m-6
  • border-2
  • overflow-hidden
  • text-3xl
  • px-3
  • border-r-2

59 steps to build a Slack clone component with Tailwind CSS

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

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

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

  4. Control the background color of an element to purple-darker using the bg-purple-darker utilities.

  5. Control the text color of an element to purple-lighter using the text-purple-lighter utilities.

  6. Use w-1/5 to set an element to a fixed width(1/5).

  7. Control the padding on bottom side of an element to 1.5rem using the pb-6 utilities.

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

  9. Use inline utilities to put the element on its own line and fill its parent at only medium screen sizes.

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

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

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

  13. Control the margin on top side of an element to 0.75rem using the mt-3 utilities.

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

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

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

  17. Control the text color of an element to purple-lightest using the text-purple-lightest utilities.

  18. Control the margin on bottom side of an element to 1.5rem using the mb-6 utilities.

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

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

  21. Use w-2 to set an element to a fixed width(0.5rem).

  22. Use h-2 to set an element to a fixed height(0.5rem).

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

  24. Control the background color of an element to teal-dark using the bg-teal-dark utilities.

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

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

  27. Control the text color of an element to grey-light using the text-grey-light utilities.

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

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

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

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

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

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

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

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

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

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

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

  39. Control the border color of an element to grey using the border-grey utilities.

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

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

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

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

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

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

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

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

  48. Control the padding on top side of an element to 0.25rem using the pt-1 utilities.

  49. Control the background color of an element to grey-lighter using the bg-grey-lighter utilities.

  50. Control the border color of an element to grey-light using the border-grey-light utilities.

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

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

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

  54. Control the margin on all sides of an element to 1.5rem using the m-6 utilities.

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

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

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

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

  59. Control the border color of an element to r-2 using the border-r-2 utilities.

Conclusion

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