Published on

Here Are 6 Ways To Build A Discord Clone With Tailwind CSS

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

Discord ui clone

Why use Tailwind CSS to create a Discord Clone ui component?

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

The preview of Discord Clone ui component

Free download of the Discord Clone's source code

The source code of Discord Clone ui component

<!-- Inspired by slack ui clone https://www.tailwindcsscomponent.com/slack-clone-1 -->

<div class="font-sans antialiased h-screen flex">
	<!-- Sidebar / channel list -->
	<div class="bg-gray-900 text-purple-lighter flex-none w-24 p-6 hidden md:block">
		<div class="cursor-pointer mb-4 border-b border-gray-600 pb-2">
			<div
				class="bg-white h-12 w-12 flex items-center justify-center text-black text-2xl font-semibold rounded-3xl mb-1 overflow-hidden">
				<img src="https://cdn.discordapp.com/embed/avatars/0.png" alt="">
            </div>
			</div>
			<div class="cursor-pointer mb-4">
				<div
					class="bg-white h-12 w-12 flex items-center justify-center text-black text-2xl font-semibold rounded-xl mb-1 overflow-hidden">
					<img src="https://cdn.discordapp.com/embed/avatars/0.png" alt="">
            </div>
				</div>
				<div class="cursor-pointer mb-4">
					<div
						class="bg-white h-12 w-12 flex items-center justify-center text-black text-2xl font-semibold rounded-3xl mb-1 overflow-hidden">
						<img src="https://cdn.discordapp.com/embed/avatars/1.png" alt="">
            </div>
					</div>
					<div class="cursor-pointer mb-4">
						<div
							class="bg-white h-12 w-12 flex items-center justify-center text-black text-2xl font-semibold rounded-3xl mb-1 overflow-hidden">
							<img src="https://cdn.discordapp.com/embed/avatars/2.png" alt="">
            </div>
						</div>
						<div class="cursor-pointer mb-4">
							<div
								class="bg-white h-12 w-12 flex items-center justify-center text-black text-2xl font-semibold rounded-3xl mb-1 overflow-hidden">
								<img src="https://cdn.discordapp.com/embed/avatars/3.png" alt="">
            </div>
							</div>
							<div class="cursor-pointer mb-4">
								<div
									class="bg-white h-12 w-12 flex items-center justify-center text-black text-2xl font-semibold rounded-3xl mb-1 overflow-hidden">
									<img src="https://cdn.discordapp.com/embed/avatars/4.png" alt="">
            </div>
								</div>
								<div class="cursor-pointer">
									<div
										class="bg-white opacity-25 h-12 w-12 flex items-center justify-center text-black text-2xl font-semibold rounded-3xl mb-1 overflow-hidden">
										<svg class="fill-current h-10 w-10 block" xmlns="http://www.w3.org/2000/svg"
											viewBox="0 0 20 20">
											<path
												d="M16 10c0 .553-.048 1-.601 1H11v4.399c0 .552-.447.601-1 .601-.553 0-1-.049-1-.601V11H4.601C4.049 11 4 10.553 4 10c0-.553.049-1 .601-1H9V4.601C9 4.048 9.447 4 10 4c.553 0 1 .048 1 .601V9h4.399c.553 0 .601.447.601 1z" />
										</svg>
									</div>
								</div>



							</div>
							<div class="bg-gray-800 text-purple-lighter flex-none w-64 pb-6 hidden md:block">
								<div
									class="text-white mb-2 mt-3 px-4 flex justify-between border-b border-gray-600 py-1 shadow-xl">
									<div class="flex-auto">
										<h1 class="font-semibold text-xl leading-tight mb-1 truncate">My Server</h1>
									</div>
									<div>
										<svg class="arrow-gKvcEx icon-2yIBmh opacity-50 cursor-pointer" width="24"
											height="24" viewBox="0 0 24 24">
											<path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"
												d="M16.59 8.59004L12 13.17L7.41 8.59004L6 10L12 16L18 10L16.59 8.59004Z">
											</path>
										</svg>
									</div>
								</div>
								<div class="mb-8">
									<div class="px-4 mb-2 text-white flex justify-between items-center">
										<div class="opacity-75 cursor-pointer">GENERAL</div>
										<div>
											<svg class="fill-current h-5 w-5 opacity-50 cursor-pointer"
												xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
												<path
													d="M16 10c0 .553-.048 1-.601 1H11v4.399c0 .552-.447.601-1 .601-.553 0-1-.049-1-.601V11H4.601C4.049 11 4 10.553 4 10c0-.553.049-1 .601-1H9V4.601C9 4.048 9.447 4 10 4c.553 0 1 .048 1 .601V9h4.399c.553 0 .601.447.601 1z" />
											</svg>
										</div>
									</div>
									<div class="bg-teal-dark cursor-pointer font-semibold py-1 px-4 text-gray-300">#
										general</div>
								</div>
								<div class="mb-8">
									<div class="px-4 mb-2 text-white flex justify-between items-center">
										<div class="opacity-75 cursor-pointer">VOICE</div>
										<div>
											<svg class="fill-current h-5 w-5 opacity-50 cursor-pointer"
												xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
												<path
													d="M16 10c0 .553-.048 1-.601 1H11v4.399c0 .552-.447.601-1 .601-.553 0-1-.049-1-.601V11H4.601C4.049 11 4 10.553 4 10c0-.553.049-1 .601-1H9V4.601C9 4.048 9.447 4 10 4c.553 0 1 .048 1 .601V9h4.399c.553 0 .601.447.601 1z" />
											</svg>
										</div>
									</div>
									<div
										class="bg-teal-dark hover:bg-gray-800 cursor-pointer font-semibold py-1 px-4 text-gray-300">
										🔊 General</div>
								</div>
							</div>
							<!-- Chat content -->
							<div class="flex-1 flex flex-col bg-gray-700 overflow-hidden">
								<!-- Top bar -->
								<div class="border-b border-gray-600 flex px-6 py-2 items-center flex-none shadow-xl">
									<div class="flex flex-col">
										<h3 class="text-white mb-1 font-bold text-xl text-gray-100">
											<span class="text-gray-400">#</span> general</h3>
									</div>
								</div>
								<!-- Chat messages -->
								<div class="px-6 py-4 flex-1 overflow-y-scroll">
									<!-- A message -->
									<div class="border-b border-gray-600 py-3 flex items-start mb-4 text-sm">
										<img src="https://cdn.discordapp.com/embed/avatars/0.png" class="cursor-pointer w-10 h-10 rounded-3xl mr-3">
										<div class="flex-1 overflow-hidden">
											<div>
												<span class="font-bold text-red-300 cursor-pointer hover:underline">User</span>
												<span class="font-bold text-gray-400 text-xs">09:23</span>
											</div>
											<p class="text-white leading-normal">Discord is awesome!</p>
										</div>
									</div>
									<!-- A message -->
									<!-- A message -->
									<div class="border-b border-gray-600 py-3 flex items-start mb-4 text-sm">
										<img src="https://cdn.discordapp.com/embed/avatars/3.png" class="cursor-pointer w-10 h-10 rounded-3xl mr-3">
										<div class="flex-1 overflow-hidden">
											<div>
												<span class="font-bold text-red-300 cursor-pointer hover:underline">User</span>
												<span class="font-bold text-gray-400 text-xs">09:24</span>
											</div>
											<p class="text-white leading-normal">Discord is awesome!</p>
										</div>
									</div>
									<!-- A message -->
									<!-- A message -->
									<div class="border-b border-gray-600 py-3 flex items-start mb-4 text-sm">
										<img src="https://cdn.discordapp.com/embed/avatars/1.png" class="cursor-pointer w-10 h-10 rounded-3xl mr-3">
										<div class="flex-1 overflow-hidden">
											<div>
												<span class="font-bold text-red-300 cursor-pointer hover:underline">User</span>
												<span class="font-bold text-gray-400 text-xs">09:26</span>
											</div>
											<p class="text-white leading-normal">Discord is awesome!</p>
										</div>
									</div>
									<!-- A message -->
									<!-- A message -->
									<div class="border-b border-gray-600 py-3 flex items-start mb-4 text-sm">
										<img src="https://cdn.discordapp.com/embed/avatars/2.png" class="cursor-pointer w-10 h-10 rounded-3xl mr-3">
										<div class="flex-1 overflow-hidden">
											<div>
												<span class="font-bold text-red-300 cursor-pointer hover:underline">User</span>
												<span class="font-bold text-gray-400 text-xs">10:00</span>
											</div>
											<p class="text-white leading-normal">Discord is awesome!</p>
										</div>
									</div>
									<!-- A message -->
									<!-- A message -->
									<div class="border-b border-gray-600 py-3 flex items-start mb-4 text-sm">
										<img src="https://cdn.discordapp.com/embed/avatars/3.png" class="cursor-pointer w-10 h-10 rounded-3xl mr-3">
										<div class="flex-1 overflow-hidden">
											<div>
												<span class="font-bold text-red-300 cursor-pointer hover:underline">User</span>
												<span class="font-bold text-gray-400 text-xs">10:20</span>
											</div>
											<p class="text-white leading-normal">Discord is awesome!</p>
										</div>
									</div>
									<!-- A message -->
									<!-- A message -->
									<div class="border-b border-gray-600 py-3 flex items-start mb-4 text-sm">
										<img src="https://cdn.discordapp.com/embed/avatars/4.png" class="cursor-pointer w-10 h-10 rounded-3xl mr-3">
										<div class="flex-1 overflow-hidden">
											<div>
												<span class="font-bold text-red-300 cursor-pointer hover:underline">User</span>
												<span class="font-bold text-gray-400 text-xs">10:23</span>
											</div>
											<p class="text-white leading-normal">Discord is awesome!</p>
										</div>
									</div>
									<!-- A message -->
									<!-- A message -->
									<div class="border-b border-gray-600 py-3 flex items-start mb-4 text-sm">
										<img src="https://cdn.discordapp.com/embed/avatars/0.png" class="cursor-pointer w-10 h-10 rounded-3xl mr-3">
										<div class="flex-1 overflow-hidden">
											<div>
												<span class="font-bold text-red-300 cursor-pointer hover:underline">User</span>
												<span class="font-bold text-gray-400 text-xs">10:30</span>
											</div>
											<p class="text-white leading-normal">Discord is awesome!</p>
										</div>
									</div>
									<!-- A message -->
									<!-- A message -->
									<div class="border-b border-gray-600 py-3 flex items-start mb-4 text-sm">
										<img src="https://cdn.discordapp.com/embed/avatars/1.png" class="cursor-pointer w-10 h-10 rounded-3xl mr-3">
										<div class="flex-1 overflow-hidden">
											<div>
												<span class="font-bold text-red-300 cursor-pointer hover:underline">User</span>
												<span class="font-bold text-gray-400 text-xs">10:50</span>
											</div>
											<p class="text-white leading-normal">Discord is awesome!</p>
										</div>
									</div>
									<!-- A message -->
									<!-- A message -->
									<div class="border-b border-gray-600 py-3 flex items-start mb-4 text-sm">
										<img src="https://cdn.discordapp.com/embed/avatars/2.png" class="cursor-pointer w-10 h-10 rounded-3xl mr-3">
										<div class="flex-1 overflow-hidden">
											<div>
												<span class="font-bold text-red-300 cursor-pointer hover:underline">User</span>
												<span class="font-bold text-gray-400 text-xs">11:30</span>
											</div>
											<p class="text-white leading-normal">Discord is awesome!</p>
										</div>
									</div>
									<!-- A message -->
									<!-- A message -->
									<div class="border-b border-gray-600 py-3 flex items-start mb-4 text-sm">
										<img src="https://cdn.discordapp.com/embed/avatars/3.png" class="cursor-pointer w-10 h-10 rounded-3xl mr-3">
										<div class="flex-1 overflow-hidden">
											<div>
												<span class="font-bold text-red-300 cursor-pointer hover:underline">User</span>
												<span class="font-bold text-gray-400 text-xs">11:37</span>
											</div>
											<p class="text-white leading-normal">Discord is awesome!</p>
										</div>
									</div>
									<!-- A message -->
									<!-- A message -->
									<div class="border-b border-gray-600 py-3 flex items-start mb-4 text-sm">
										<img src="https://cdn.discordapp.com/embed/avatars/4.png" class="cursor-pointer w-10 h-10 rounded-3xl mr-3">
										<div class="flex-1 overflow-hidden">
											<div>
												<span class="font-bold text-red-300 cursor-pointer hover:underline">User</span>
												<span class="font-bold text-gray-400 text-xs">11:45</span>
											</div>
											<p class="text-white leading-normal">Discord is awesome!</p>
										</div>
									</div>
									<!-- A message -->
									<!-- A message -->
									<div class="border-b border-gray-600 py-3 flex items-start mb-4 text-sm">
										<img src="https://cdn.discordapp.com/embed/avatars/1.png" class="cursor-pointer w-10 h-10 rounded-3xl mr-3">
										<div class="flex-1 overflow-hidden">
											<div>
												<span class="font-bold text-red-300 cursor-pointer hover:underline">User</span>
												<span class="font-bold text-gray-400 text-xs">11:50</span>
											</div>
											<p class="text-white leading-normal">Discord is awesome!</p>
										</div>
									</div>
									<!-- A message -->
									<!-- A message -->
									<div class="border-b border-gray-600 py-3 flex items-start mb-4 text-sm">
										<img src="https://cdn.discordapp.com/embed/avatars/2.png" class="cursor-pointer w-10 h-10 rounded-3xl mr-3">
										<div class="flex-1 overflow-hidden">
											<div>
												<span class="font-bold text-red-300 cursor-pointer hover:underline">User</span>
												<span class="font-bold text-gray-400 text-xs">11:55</span>
											</div>
											<p class="text-white leading-normal">Discord is awesome!</p>
										</div>
									</div>
									<!-- A message -->
									<!-- A message -->
									<div class="border-b border-gray-600 py-3 flex items-start mb-4 text-sm">
										<img src="https://cdn.discordapp.com/embed/avatars/3.png" class="cursor-pointer w-10 h-10 rounded-3xl mr-3">
										<div class="flex-1 overflow-hidden">
											<div>
												<span class="font-bold text-red-300 cursor-pointer hover:underline">User</span>
												<span class="font-bold text-gray-400 text-xs">11:59</span>
											</div>
											<p class="text-white leading-normal">Discord is awesome!</p>
										</div>
									</div>
									<!-- A message -->
									<!-- A message -->
									<div class="border-b border-gray-600 py-3 flex items-start mb-4 text-sm">
										<img src="https://cdn.discordapp.com/embed/avatars/4.png" class="cursor-pointer w-10 h-10 rounded-3xl mr-3">
										<div class="flex-1 overflow-hidden">
											<div>
												<span class="font-bold text-red-300 cursor-pointer hover:underline">User</span>
												<span class="font-bold text-gray-400 text-xs">12:00</span>
											</div>
											<p class="text-white leading-normal">Discord is awesome!</p>
										</div>
									</div>
									<!-- A message -->
								</div>
								<div class="pb-6 px-4 flex-none">
									<div class="flex rounded-lg overflow-hidden">
										<span class="text-3xl text-grey border-r-4 border-gray-600 bg-gray-600 p-2">
                    <svg class="h-6 w-6 block bg-gray-500 hover:bg-gray-400 cursor-pointer rounded-xl" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M16 10c0 .553-.048 1-.601 1H11v4.399c0 .552-.447.601-1 .601-.553 0-1-.049-1-.601V11H4.601C4.049 11 4 10.553 4 10c0-.553.049-1 .601-1H9V4.601C9 4.048 9.447 4 10 4c.553 0 1 .048 1 .601V9h4.399c.553 0 .601.447.601 1z" fill="#FFFFFF"/></svg>
                  </span>
										<input type="text" class="w-full px-4 bg-gray-600" placeholder="Message #general" />
            </div>
									</div>
								</div>
							</div>

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

  • h-screen
  • flex
  • bg-gray-900
  • text-purple-lighter
  • flex-none
  • w-24
  • p-6
  • hidden
  • md:block
  • mb-4
  • border-b
  • border-gray-600
  • pb-2
  • bg-white
  • h-12
  • w-12
  • text-black
  • text-2xl
  • mb-1
  • overflow-hidden
  • h-10
  • w-10
  • block
  • bg-gray-800
  • w-64
  • pb-6
  • text-white
  • mb-2
  • mt-3
  • px-4
  • py-1
  • flex-auto
  • text-xl
  • mb-8
  • h-5
  • w-5
  • bg-teal-dark
  • text-gray-300
  • hover:bg-gray-800
  • flex-1
  • flex-col
  • bg-gray-700
  • px-6
  • py-2
  • text-gray-100
  • text-gray-400
  • py-4
  • overflow-y-scroll
  • py-3
  • text-sm
  • mr-3
  • text-red-300
  • text-xs
  • text-3xl
  • text-grey
  • border-r-4
  • bg-gray-600
  • p-2
  • h-6
  • w-6
  • bg-gray-500
  • hover:bg-gray-400
  • w-full

63 steps to create a Discord Clone component with Tailwind CSS

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

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

  3. Control the background color of an element to gray-900 using the bg-gray-900 utilities.

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

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

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

  7. Control the padding on all sides of an element to 1.5rem using the p-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 margin on bottom side of an element to 1rem using the mb-4 utilities.

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

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

  13. Control the padding on bottom side of an element to 0.5rem using the pb-2 utilities.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  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.25rem using the py-1 utilities.

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

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

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

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

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

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

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

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

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

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

  42. Control the background color of an element to gray-700 using the bg-gray-700 utilities.

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

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

  45. Control the text color of an element to gray-100 using the text-gray-100 utilities.

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

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

  48. Use overflow-y-scroll to allow vertical scrolling and always show scrollbars unless always-visible scrollbars are disabled by the operating system.

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

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

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

  52. Control the text color of an element to red-300 using the text-red-300 utilities.

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

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

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

  56. Control the border color of an element to r-4 using the border-r-4 utilities.

  57. Control the background color of an element to gray-600 using the bg-gray-600 utilities.

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

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

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

  61. Control the background color of an element to gray-500 using the bg-gray-500 utilities.

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

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

Conclusion

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