- Published on
Ways To Build A QuickChat - Chat Layout. With Tailwind CSS In 60 Minutes

- What is Tailwind CSS?
- The description of QuickChat - Chat Layout. ui component
- Why use Tailwind CSS to build a QuickChat - Chat Layout. ui component?
- The preview of QuickChat - Chat Layout. ui component
- The source code of QuickChat - Chat Layout. ui component
- How to build a QuickChat - Chat Layout. with Tailwind CSS?
- Install tailwind css of verion 1.9.6
- All the unility class needed to build a QuickChat - Chat Layout. component
- 100 steps to build a QuickChat - Chat Layout. component with Tailwind CSS
- Conclusion
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 QuickChat - Chat Layout. ui component
Quickchat - chat layout.
Why use Tailwind CSS to build a QuickChat - Chat Layout. ui component?
- It can make the building process of QuickChat - Chat Layout. ui component faster and more easily.
- Enables building complex responsive layouts and components freely.
- Minimum lines of CSS code in QuickChat - Chat Layout. component file.
The preview of QuickChat - Chat Layout. ui component
Free download of the QuickChat - Chat Layout.'s source code
The source code of QuickChat - Chat Layout. ui component
<div class="flex h-screen antialiased text-gray-800">
<div class="flex flex-row h-full w-full overflow-x-hidden">
<div class="flex flex-col py-8 pl-6 pr-2 w-64 bg-white flex-shrink-0">
<div class="flex flex-row items-center justify-center h-12 w-full">
<div
class="flex items-center justify-center rounded-2xl text-indigo-700 bg-indigo-100 h-10 w-10"
>
<svg
class="w-6 h-6"
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="M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"
></path>
</svg>
</div>
<div class="ml-2 font-bold text-2xl">QuickChat</div>
</div>
<div
class="flex flex-col items-center bg-indigo-100 border border-gray-200 mt-4 w-full py-6 px-4 rounded-lg"
>
<div class="h-20 w-20 rounded-full border overflow-hidden">
<img
src="https://avatars3.githubusercontent.com/u/2763884?s=128"
alt="Avatar"
class="h-full w-full"
/>
</div>
<div class="text-sm font-semibold mt-2">Aminos Co.</div>
<div class="text-xs text-gray-500">Lead UI/UX Designer</div>
<div class="flex flex-row items-center mt-3">
<div
class="flex flex-col justify-center h-4 w-8 bg-indigo-500 rounded-full"
>
<div class="h-3 w-3 bg-white rounded-full self-end mr-1"></div>
</div>
<div class="leading-none ml-1 text-xs">Active</div>
</div>
</div>
<div class="flex flex-col mt-8">
<div class="flex flex-row items-center justify-between text-xs">
<span class="font-bold">Active Conversations</span>
<span
class="flex items-center justify-center bg-gray-300 h-4 w-4 rounded-full"
>4</span
>
</div>
<div class="flex flex-col space-y-1 mt-4 -mx-2 h-48 overflow-y-auto">
<button
class="flex flex-row items-center hover:bg-gray-100 rounded-xl p-2"
>
<div
class="flex items-center justify-center h-8 w-8 bg-indigo-200 rounded-full"
>
H
</div>
<div class="ml-2 text-sm font-semibold">Henry Boyd</div>
</button>
<button
class="flex flex-row items-center hover:bg-gray-100 rounded-xl p-2"
>
<div
class="flex items-center justify-center h-8 w-8 bg-gray-200 rounded-full"
>
M
</div>
<div class="ml-2 text-sm font-semibold">Marta Curtis</div>
<div
class="flex items-center justify-center ml-auto text-xs text-white bg-red-500 h-4 w-4 rounded leading-none"
>
2
</div>
</button>
<button
class="flex flex-row items-center hover:bg-gray-100 rounded-xl p-2"
>
<div
class="flex items-center justify-center h-8 w-8 bg-orange-200 rounded-full"
>
P
</div>
<div class="ml-2 text-sm font-semibold">Philip Tucker</div>
</button>
<button
class="flex flex-row items-center hover:bg-gray-100 rounded-xl p-2"
>
<div
class="flex items-center justify-center h-8 w-8 bg-pink-200 rounded-full"
>
C
</div>
<div class="ml-2 text-sm font-semibold">Christine Reid</div>
</button>
<button
class="flex flex-row items-center hover:bg-gray-100 rounded-xl p-2"
>
<div
class="flex items-center justify-center h-8 w-8 bg-purple-200 rounded-full"
>
J
</div>
<div class="ml-2 text-sm font-semibold">Jerry Guzman</div>
</button>
</div>
<div class="flex flex-row items-center justify-between text-xs mt-6">
<span class="font-bold">Archivied</span>
<span
class="flex items-center justify-center bg-gray-300 h-4 w-4 rounded-full"
>7</span
>
</div>
<div class="flex flex-col space-y-1 mt-4 -mx-2">
<button
class="flex flex-row items-center hover:bg-gray-100 rounded-xl p-2"
>
<div
class="flex items-center justify-center h-8 w-8 bg-indigo-200 rounded-full"
>
H
</div>
<div class="ml-2 text-sm font-semibold">Henry Boyd</div>
</button>
</div>
</div>
</div>
<div class="flex flex-col flex-auto h-full p-6">
<div
class="flex flex-col flex-auto flex-shrink-0 rounded-2xl bg-gray-100 h-full p-4"
>
<div class="flex flex-col h-full overflow-x-auto mb-4">
<div class="flex flex-col h-full">
<div class="grid grid-cols-12 gap-y-2">
<div class="col-start-1 col-end-8 p-3 rounded-lg">
<div class="flex flex-row items-center">
<div
class="flex items-center justify-center h-10 w-10 rounded-full bg-indigo-500 flex-shrink-0"
>
A
</div>
<div
class="relative ml-3 text-sm bg-white py-2 px-4 shadow rounded-xl"
>
<div>Hey How are you today?</div>
</div>
</div>
</div>
<div class="col-start-1 col-end-8 p-3 rounded-lg">
<div class="flex flex-row items-center">
<div
class="flex items-center justify-center h-10 w-10 rounded-full bg-indigo-500 flex-shrink-0"
>
A
</div>
<div
class="relative ml-3 text-sm bg-white py-2 px-4 shadow rounded-xl"
>
<div>
Lorem ipsum dolor sit amet, consectetur adipisicing
elit. Vel ipsa commodi illum saepe numquam maxime
asperiores voluptate sit, minima perspiciatis.
</div>
</div>
</div>
</div>
<div class="col-start-6 col-end-13 p-3 rounded-lg">
<div class="flex items-center justify-start flex-row-reverse">
<div
class="flex items-center justify-center h-10 w-10 rounded-full bg-indigo-500 flex-shrink-0"
>
A
</div>
<div
class="relative mr-3 text-sm bg-indigo-100 py-2 px-4 shadow rounded-xl"
>
<div>I'm ok what about you?</div>
</div>
</div>
</div>
<div class="col-start-6 col-end-13 p-3 rounded-lg">
<div class="flex items-center justify-start flex-row-reverse">
<div
class="flex items-center justify-center h-10 w-10 rounded-full bg-indigo-500 flex-shrink-0"
>
A
</div>
<div
class="relative mr-3 text-sm bg-indigo-100 py-2 px-4 shadow rounded-xl"
>
<div>
Lorem ipsum dolor sit, amet consectetur adipisicing. ?
</div>
</div>
</div>
</div>
<div class="col-start-1 col-end-8 p-3 rounded-lg">
<div class="flex flex-row items-center">
<div
class="flex items-center justify-center h-10 w-10 rounded-full bg-indigo-500 flex-shrink-0"
>
A
</div>
<div
class="relative ml-3 text-sm bg-white py-2 px-4 shadow rounded-xl"
>
<div>Lorem ipsum dolor sit amet !</div>
</div>
</div>
</div>
<div class="col-start-6 col-end-13 p-3 rounded-lg">
<div class="flex items-center justify-start flex-row-reverse">
<div
class="flex items-center justify-center h-10 w-10 rounded-full bg-indigo-500 flex-shrink-0"
>
A
</div>
<div
class="relative mr-3 text-sm bg-indigo-100 py-2 px-4 shadow rounded-xl"
>
<div>
Lorem ipsum dolor sit, amet consectetur adipisicing. ?
</div>
<div
class="absolute text-xs bottom-0 right-0 -mb-5 mr-2 text-gray-500"
>
Seen
</div>
</div>
</div>
</div>
<div class="col-start-1 col-end-8 p-3 rounded-lg">
<div class="flex flex-row items-center">
<div
class="flex items-center justify-center h-10 w-10 rounded-full bg-indigo-500 flex-shrink-0"
>
A
</div>
<div
class="relative ml-3 text-sm bg-white py-2 px-4 shadow rounded-xl"
>
<div>
Lorem ipsum dolor sit amet consectetur adipisicing elit.
Perspiciatis, in.
</div>
</div>
</div>
</div>
<div class="col-start-1 col-end-8 p-3 rounded-lg">
<div class="flex flex-row items-center">
<div
class="flex items-center justify-center h-10 w-10 rounded-full bg-indigo-500 flex-shrink-0"
>
A
</div>
<div
class="relative ml-3 text-sm bg-white py-2 px-4 shadow rounded-xl"
>
<div class="flex flex-row items-center">
<button
class="flex items-center justify-center bg-indigo-600 hover:bg-indigo-800 rounded-full h-8 w-10"
>
<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="1.5"
d="M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"
></path>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="1.5"
d="M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
></path>
</svg>
</button>
<div class="flex flex-row items-center space-x-px ml-4">
<div class="h-2 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-2 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-4 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-8 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-8 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-10 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-10 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-12 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-10 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-6 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-5 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-4 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-3 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-2 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-2 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-2 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-10 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-2 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-10 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-8 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-8 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-1 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-1 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-2 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-8 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-8 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-2 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-2 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-2 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-2 w-1 bg-gray-500 rounded-lg"></div>
<div class="h-4 w-1 bg-gray-500 rounded-lg"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div
class="flex flex-row items-center h-16 rounded-xl bg-white w-full px-4"
>
<div>
<button
class="flex items-center justify-center text-gray-400 hover:text-gray-600"
>
<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>
</div>
<div class="flex-grow ml-4">
<div class="relative w-full">
<input
type="text"
class="flex w-full border rounded-xl focus:outline-none focus:border-indigo-300 pl-4 h-10"
/>
<button
class="absolute flex items-center justify-center h-full w-12 right-0 top-0 text-gray-400 hover:text-gray-600"
>
<svg
class="w-6 h-6"
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="M14.828 14.828a4 4 0 01-5.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
></path>
</svg>
</button>
</div>
</div>
<div class="ml-4">
<button
class="flex items-center justify-center bg-indigo-500 hover:bg-indigo-600 rounded-xl text-white px-4 py-1 flex-shrink-0"
>
<span>Send</span>
<span class="ml-2">
<svg
class="w-4 h-4 transform rotate-45 -mt-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>
</span>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
How to build a QuickChat - Chat Layout. with Tailwind CSS?
Install tailwind css of verion 1.9.6
Use the link
html tag to import the stylesheet of Tailwind CSS of the version 1.9.6
<link href=https://unpkg.com/[email protected]/dist/tailwind.min.css rel="stylesheet">
All the unility class needed to build a QuickChat - Chat Layout. component
flex
h-screen
text-gray-800
flex-row
h-full
w-full
flex-col
py-8
pl-6
pr-2
w-64
bg-white
flex-shrink-0
h-12
text-indigo-700
bg-indigo-100
h-10
w-10
w-6
h-6
ml-2
text-2xl
border-gray-200
mt-4
py-6
px-4
h-20
w-20
overflow-hidden
text-sm
mt-2
text-xs
text-gray-500
mt-3
h-4
w-8
bg-indigo-500
h-3
w-3
mr-1
ml-1
mt-8
bg-gray-300
w-4
-mx-2
h-48
overflow-y-auto
hover:bg-gray-100
p-2
h-8
bg-indigo-200
bg-gray-200
ml-auto
text-white
bg-red-500
bg-orange-200
bg-pink-200
bg-purple-200
mt-6
flex-auto
p-6
bg-gray-100
p-4
overflow-x-auto
mb-4
grid
grid-cols-12
gap-y-2
p-3
relative
ml-3
py-2
justify-start
flex-row-reverse
mr-3
absolute
bottom-0
right-0
-mb-5
mr-2
bg-indigo-600
hover:bg-indigo-800
ml-4
h-2
w-1
bg-gray-500
h-5
h-1
h-16
text-gray-400
hover:text-gray-600
w-5
flex-grow
focus:border-indigo-300
pl-4
w-12
top-0
hover:bg-indigo-600
py-1
-mt-px
100 steps to build a QuickChat - Chat Layout. component with Tailwind CSS
Use
flex
to create a block-level flex container.Use
h-screen
to make an element span the entire height of the viewport.Control the text color of an element to gray-800 using the
text-gray-800
utilities.Use
flex
to create a block-level flex container.Use
h-full
to set an element’s height to 100% of its parent, as long as the parent has a defined height.Use
w-full
to set an element to a 100% based width.Use
flex
to create a block-level flex container.Control the vertical padding of an element to 2rem using the
py-8
utilities.Adjust the left padding of an element to 1.5rem using the
pl-6
utilities classControl the padding on right side of an element to 0.5rem using the
pr-2
utilities.Use
w-64
to set an element to a fixed width(16rem).Control the background color of an element to white using the
bg-white
utilities.Use
flex
to create a block-level flex container.Use
h-12
to set an element to a fixed height(3rem).Control the text color of an element to indigo-700 using the
text-indigo-700
utilities.Control the background color of an element to indigo-100 using the
bg-indigo-100
utilities.Use
h-10
to set an element to a fixed height(2.5rem).Use
w-10
to set an element to a fixed width(2.5rem).Use
w-6
to set an element to a fixed width(1.5rem).Use
h-6
to set an element to a fixed height(1.5rem).Control the margin on left side of an element to 0.5rem using the
ml-2
utilities.Control the text color of an element to 2xl using the
text-2xl
utilities.Control the border color of an element to gray-200 using the
border-gray-200
utilities.Control the margin on top side of an element to 1rem using the
mt-4
utilities.Control the vertical padding of an element to 1.5rem using the
py-6
utilities.Control the horizontal padding of an element to 1rem using the
px-4
utilities.Use
h-20
to set an element to a fixed height(5rem).Use
w-20
to set an element to a fixed width(5rem).Use
overflow-hidden
to clip any content within an element that overflows the bounds of that element.Control the text color of an element to sm using the
text-sm
utilities.Control the margin on top side of an element to 0.5rem using the
mt-2
utilities.Control the text color of an element to xs using the
text-xs
utilities.Control the text color of an element to gray-500 using the
text-gray-500
utilities.Control the margin on top side of an element to 0.75rem using the
mt-3
utilities.Use
h-4
to set an element to a fixed height(1rem).Use
w-8
to set an element to a fixed width(2rem).Control the background color of an element to indigo-500 using the
bg-indigo-500
utilities.Use
h-3
to set an element to a fixed height(0.75rem).Use
w-3
to set an element to a fixed width(0.75rem).Control the margin on right side of an element to 0.25rem using the
mr-1
utilities.Control the margin on left side of an element to 0.25rem using the
ml-1
utilities.Control the margin on top side of an element to 2rem using the
mt-8
utilities.Control the background color of an element to gray-300 using the
bg-gray-300
utilities.Use
w-4
to set an element to a fixed width(1rem).Control the horizontal margin of an element to -0.5rem using the
-mx-2
utilities.Use
h-48
to set an element to a fixed height(12rem).Use
overflow-y-auto
to allow vertical scrolling if needed.Control the background color of an element to gray-100 using the
hover:bg-gray-100
utilities on hover.Control the padding on all sides of an element to 0.5rem using the
p-2
utilities.Use
h-8
to set an element to a fixed height(2rem).Control the background color of an element to indigo-200 using the
bg-indigo-200
utilities.Control the background color of an element to gray-200 using the
bg-gray-200
utilities.Control the margin on left side of an element to auto using the
ml-auto
utilities.Control the text color of an element to white using the
text-white
utilities.Control the background color of an element to red-500 using the
bg-red-500
utilities.Control the background color of an element to orange-200 using the
bg-orange-200
utilities.Control the background color of an element to pink-200 using the
bg-pink-200
utilities.Control the background color of an element to purple-200 using the
bg-purple-200
utilities.Control the margin on top side of an element to 1.5rem using the
mt-6
utilities.Use
flex
to create a block-level flex container.Control the padding on all sides of an element to 1.5rem using the
p-6
utilities.Control the background color of an element to gray-100 using the
bg-gray-100
utilities.Control the padding on all sides of an element to 1rem using the
p-4
utilities.Use
overflow-x-auto
to allow horizontal scrolling if needed.Control the margin on bottom side of an element to 1rem using the
mb-4
utilities.Use
grid
to create a grid container.Use
grid
to create a grid container.To specify the width between columns, you can use the
gap-y-2
utilities.Control the padding on all sides of an element to 0.75rem using the
p-3
utilities.Use
relative
to position an element according to the normal flow of the document.Control the margin on left side of an element to 0.75rem using the
ml-3
utilities.Control the vertical padding of an element to 0.5rem using the
py-2
utilities.Use
justify-start
to justify items against the start of the container’s main axis.Use
flex
to create a block-level flex container.Control the margin on right side of an element to 0.75rem using the
mr-3
utilities.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.Use the
bottom-0
utilities to set the bottom position of a positioned element to 0rem.Use the
right-0
utilities to set the right position of a positioned element to 0rem.Control the margin on bottom side of an element to -1.25rem using the
-mb-5
utilities.Control the margin on right side of an element to 0.5rem using the
mr-2
utilities.Control the background color of an element to indigo-600 using the
bg-indigo-600
utilities.Control the background color of an element to indigo-800 using the
hover:bg-indigo-800
utilities on hover.Control the margin on left side of an element to 1rem using the
ml-4
utilities.Use
h-2
to set an element to a fixed height(0.5rem).Use
w-1
to set an element to a fixed width(0.25rem).Control the background color of an element to gray-500 using the
bg-gray-500
utilities.Use
h-5
to set an element to a fixed height(1.25rem).Use
h-1
to set an element to a fixed height(0.25rem).Use
h-16
to set an element to a fixed height(4rem).Control the text color of an element to gray-400 using the
text-gray-400
utilities.Control the text color of an element to gray-600 on hover using the
hover:text-gray-600
utilities.Use
w-5
to set an element to a fixed width(1.25rem).Use
flex
to create a block-level flex container.Control the border color of an element to indigo-300 using the
focus:border-indigo-300
utilities on focus.Adjust the left padding of an element to 1rem using the
pl-4
utilities classUse
w-12
to set an element to a fixed width(3rem).Use the
top-0
utilities to set the top position of a positioned element to 0rem.Control the background color of an element to indigo-600 using the
hover:bg-indigo-600
utilities on hover.Control the vertical padding of an element to 0.25rem using the
py-1
utilities.Control the margin on top side of an element to px using the
-mt-px
utilities.
Conclusion
The above is a step-by-step tutorial on how to use Tailwind CSS to build a QuickChat - Chat Layout. components, learn and follow along to implement your own components.