- Published on
The Ultimate Guide To Help You Make A social feed With Tailwind CSS

- What is Tailwind CSS?
- The description of social feed ui component
- Why use Tailwind CSS to create a social feed ui component?
- The preview of social feed ui component
- The source code of social feed ui component
- How to create a social feed with Tailwind CSS?
- Install tailwind css of verion 3.0.18
- All the unility class needed to create a social feed component
- 70 steps to create a social feed 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 social feed ui component
Social feed
Why use Tailwind CSS to create a social feed ui component?
- It can make the building process of social feed ui component faster and more easily.
- Enables building complex responsive layouts and components freely.
- Minimum lines of CSS code in social feed component file.
The preview of social feed ui component
Free download of the social feed's source code
The source code of social feed ui component
<!-- Component Start -->
<div class="flex justify-center w-screen h-screen px-4 text-gray-700">
<div class="flex w-full max-w-screen-lg">
<div class="flex flex-col w-64 py-4 pr-3">
<a class="px-3 py-2 mt-2 text-lg font-medium rounded-sm hover:bg-gray-300" href="#">Home</a>
<a class="px-3 py-2 mt-2 text-lg font-medium rounded-sm hover:bg-gray-300" href="#">Discover</a>
<a class="px-3 py-2 mt-2 text-lg font-medium rounded-sm hover:bg-gray-300" href="#">Notifications</a>
<a class="px-3 py-2 mt-2 text-lg font-medium rounded-sm hover:bg-gray-300" href="#">Inbox</a>
<a class="px-3 py-2 mt-2 text-lg font-medium rounded-sm hover:bg-gray-300" href="#">Saved Posts</a>
<a class="px-3 py-2 mt-2 text-lg font-medium rounded-sm hover:bg-gray-300" href="#">Groups</a>
<a class="px-3 py-2 mt-2 text-lg font-medium rounded-sm hover:bg-gray-300" href="#">Profile</a>
<a class="flex px-3 py-2 mt-2 mt-auto text-lg rounded-sm font-medium hover:bg-gray-200" href="#">
<span class="flex-shrink-0 w-10 h-10 bg-gray-400 rounded-full"></span>
<div class="flex flex-col ml-2">
<span class="mt-1 text-sm font-semibold leading-none">Username</span>
<span class="mt-1 text-xs leading-none">@username</span>
</div>
</a>
</div>
<div class="flex flex-col flex-grow border-l border-r border-gray-300">
<div class="flex justify-between flex-shrink-0 px-8 py-4 border-b border-gray-300">
<h1 class="text-xl font-semibold">Feed Title</h1>
<button class="flex items-center h-8 px-2 text-sm bg-gray-300 rounded-sm hover:bg-gray-400">New post</button>
</div>
<div class="flex-grow h-0 overflow-auto">
<div class="flex w-full p-8 border-b-4 border-gray-300">
<span class="flex-shrink-0 w-12 h-12 bg-gray-400 rounded-full"></span>
<div class="flex flex-col flex-grow ml-4">
<textarea class="p-3 bg-transparent border border-gray-500 rounded-sm" name="" id="" rows="3" placeholder="What's happening?"></textarea>
<div class="flex justify-between mt-2">
<button class="flex items-center h-8 px-3 text-xs rounded-sm hover:bg-gray-200">Attach</button>
<button class="flex items-center h-8 px-3 text-xs rounded-sm bg-gray-300 hover:bg-gray-400">Post</button>
</div>
</div>
</div>
<div class="flex w-full p-8 border-b border-gray-300">
<span class="flex-shrink-0 w-12 h-12 bg-gray-400 rounded-full"></span>
<div class="flex flex-col flex-grow ml-4">
<div class="flex">
<span class="font-semibold">Username</span>
<span class="ml-1">@username</span>
<span class="ml-auto text-sm">Just now</span>
</div>
<p class="mt-1">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. <a class="underline" href="#">#hashtag</a></p>
<div class="flex mt-2">
<button class="text-sm font-semibold">Like</button>
<button class="ml-2 text-sm font-semibold">Reply</button>
<button class="ml-2 text-sm font-semibold">Share</button>
</div>
</div>
</div>
<div class="flex w-full p-8 border-b border-gray-300">
<span class="flex-shrink-0 w-12 h-12 bg-gray-400 rounded-full"></span>
<div class="flex flex-col flex-grow ml-4">
<div class="flex">
<span class="font-semibold">Username</span>
<span class="ml-1">@username</span>
<span class="ml-auto text-sm">Just now</span>
</div>
<p class="mt-1">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. <a class="underline" href="#">#hashtag</a></p>
<div class="flex mt-2">
<button class="text-sm font-semibold">Like</button>
<button class="ml-2 text-sm font-semibold">Reply</button>
<button class="ml-2 text-sm font-semibold">Share</button>
</div>
</div>
</div>
<div class="flex w-full p-8 border-b border-gray-300">
<span class="flex-shrink-0 w-12 h-12 bg-gray-400 rounded-full"></span>
<div class="flex flex-col flex-grow ml-4">
<div class="flex">
<span class="font-semibold">Username</span>
<span class="ml-1">@username</span>
<span class="ml-auto text-sm">Just now</span>
</div>
<p class="mt-1">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. <a class="underline" href="#">#hashtag</a></p>
<div class="flex items-center justify-center h-64 mt-2 bg-gray-200">
<span class="font-semibold text-gray-500">Image</span>
</div>
<div class="flex mt-2">
<button class="text-sm font-semibold">Like</button>
<button class="ml-2 text-sm font-semibold">Reply</button>
<button class="ml-2 text-sm font-semibold">Share</button>
</div>
</div>
</div>
<div class="flex w-full p-8 border-b border-gray-300">
<span class="flex-shrink-0 w-12 h-12 bg-gray-400 rounded-full"></span>
<div class="flex flex-col flex-grow ml-4">
<div class="flex">
<span class="font-semibold">Username</span>
<span class="ml-1">@username</span>
<span class="ml-auto text-sm">Just now</span>
</div>
<p class="mt-1">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. <a class="underline" href="#">#hashtag</a></p>
<div class="flex mt-2">
<button class="text-sm font-semibold">Like</button>
<button class="ml-2 text-sm font-semibold">Reply</button>
<button class="ml-2 text-sm font-semibold">Share</button>
</div>
</div>
</div>
<div class="flex w-full p-8 border-b border-gray-300">
<span class="flex-shrink-0 w-12 h-12 bg-gray-400 rounded-full"></span>
<div class="flex flex-col flex-grow ml-4">
<div class="flex">
<span class="font-semibold">Username</span>
<span class="ml-1">@username</span>
<span class="ml-auto text-sm">Just now</span>
</div>
<p class="mt-1">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. <a class="underline" href="#">#hashtag</a></p>
<div class="flex mt-2">
<button class="text-sm font-semibold">Like</button>
<button class="ml-2 text-sm font-semibold">Reply</button>
<button class="ml-2 text-sm font-semibold">Share</button>
</div>
</div>
</div>
<div class="flex w-full p-8 border-b border-gray-300">
<span class="flex-shrink-0 w-12 h-12 bg-gray-400 rounded-full"></span>
<div class="flex flex-col flex-grow ml-4">
<div class="flex">
<span class="font-semibold">Username</span>
<span class="ml-1">@username</span>
<span class="ml-auto text-sm">Just now</span>
</div>
<p class="mt-1">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. <a class="underline" href="#">#hashtag</a></p>
<div class="flex items-center justify-center h-64 mt-2 bg-gray-200">
<span class="font-semibold text-gray-500">Image</span>
</div>
<div class="flex mt-2">
<button class="text-sm font-semibold">Like</button>
<button class="ml-2 text-sm font-semibold">Reply</button>
<button class="ml-2 text-sm font-semibold">Share</button>
</div>
</div>
</div>
<div class="flex w-full p-8 border-b border-gray-300">
<span class="flex-shrink-0 w-12 h-12 bg-gray-400 rounded-full"></span>
<div class="flex flex-col flex-grow ml-4">
<div class="flex">
<span class="font-semibold">Username</span>
<span class="ml-1">@username</span>
<span class="ml-auto text-sm">Just now</span>
</div>
<p class="mt-1">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. <a class="underline" href="#">#hashtag</a></p>
<div class="flex items-center justify-center h-64 mt-2 bg-gray-200">
<span class="font-semibold text-gray-500">Image</span>
</div>
<div class="flex mt-2">
<button class="text-sm font-semibold">Like</button>
<button class="ml-2 text-sm font-semibold">Reply</button>
<button class="ml-2 text-sm font-semibold">Share</button>
</div>
</div>
</div>
</div>
</div>
<div class="flex flex-col flex-shrink-0 w-1/4 py-4 pl-4">
<input class="flex items-center h-8 px-2 border border-gray-500 rounded-sm" type="search" Placeholder="Search…">
<div>
<h3 class="mt-6 font-semibold">Trending</h3>
<div class="flex w-full py-4 border-b border-gray-300">
<span class="flex-shrink-0 w-10 h-10 bg-gray-400 rounded-full"></span>
<div class="flex flex-col flex-grow ml-2">
<div class="flex text-sm">
<span class="font-semibold">Username</span>
<span class="ml-1">@username</span>
</div>
<p class="mt-1 text-sm">Lorem ipsum dolor sit amet, consectetur adipiscing elit, et dolore magna aliqua. <a class="underline" href="#">#hashtag</a></p>
</div>
</div>
<div class="flex w-full py-4 border-b border-gray-300">
<span class="flex-shrink-0 w-10 h-10 bg-gray-400 rounded-full"></span>
<div class="flex flex-col flex-grow ml-2">
<div class="flex text-sm">
<span class="font-semibold">Username</span>
<span class="ml-1">@username</span>
</div>
<p class="mt-1 text-sm">Lorem ipsum dolor sit amet, consectetur adipiscing elit, et dolore magna aliqua. <a class="underline" href="#">#hashtag</a></p>
</div>
</div>
<div class="flex w-full py-4 border-b border-gray-300">
<span class="flex-shrink-0 w-10 h-10 bg-gray-400 rounded-full"></span>
<div class="flex flex-col flex-grow ml-2">
<div class="flex text-sm">
<span class="font-semibold">Username</span>
<span class="ml-1">@username</span>
</div>
<p class="mt-1 text-sm">Lorem ipsum dolor sit amet, consectetur adipiscing elit, et dolore magna aliqua. <a class="underline" href="#">#hashtag</a></p>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Component End -->
<a class="fixed flex items-center justify-center h-8 pr-2 pl-1 bg-blue-600 rounded-full bottom-0 right-0 mr-4 mb-4 shadow-lg text-blue-100 hover:bg-blue-600" href="https://twitter.com/lofiui" target="_top">
<div class="flex items-center justify-center h-6 w-6 bg-blue-500 rounded-full">
<svg class="w-4 h-4 fill-current" viewBox="0 0 24 24" class="r-jwli3a r-4qtqp9 r-yyyyoo r-16y2uox r-1q142lx r-8kz0gk r-dnmrzs r-bnwqim r-1plcrui r-lrvibr r-1srniue"><g><path d="M23.643 4.937c-.835.37-1.732.62-2.675.733.962-.576 1.7-1.49 2.048-2.578-.9.534-1.897.922-2.958 1.13-.85-.904-2.06-1.47-3.4-1.47-2.572 0-4.658 2.086-4.658 4.66 0 .364.042.718.12 1.06-3.873-.195-7.304-2.05-9.602-4.868-.4.69-.63 1.49-.63 2.342 0 1.616.823 3.043 2.072 3.878-.764-.025-1.482-.234-2.11-.583v.06c0 2.257 1.605 4.14 3.737 4.568-.392.106-.803.162-1.227.162-.3 0-.593-.028-.877-.082.593 1.85 2.313 3.198 4.352 3.234-1.595 1.25-3.604 1.995-5.786 1.995-.376 0-.747-.022-1.112-.065 2.062 1.323 4.51 2.093 7.14 2.093 8.57 0 13.255-7.098 13.255-13.254 0-.2-.005-.402-.014-.602.91-.658 1.7-1.477 2.323-2.41z"></path></g></svg>
</div>
<span class="text-sm ml-1 leading-none">@tailwind</span>
</a>
How to create a social feed with Tailwind CSS?
Install tailwind css of verion 3.0.18
Use the script
html tag to import the script of Tailwind CSS of the version 3.0.18
<script src="https://cdn.tailwindcss.com"></script>
All the unility class needed to create a social feed component
flex
w-screen
h-screen
px-4
text-gray-700
w-full
max-w-screen-lg
flex-col
w-64
py-4
pr-3
px-3
py-2
mt-2
text-lg
hover:bg-gray-300
mt-auto
hover:bg-gray-200
flex-shrink-0
w-10
h-10
bg-gray-400
ml-2
mt-1
text-sm
text-xs
flex-grow
border-l
border-r
border-gray-300
px-8
border-b
text-xl
h-8
px-2
bg-gray-300
hover:bg-gray-400
h-0
overflow-auto
p-8
border-b-4
w-12
h-12
ml-4
p-3
bg-transparent
border-gray-500
ml-1
ml-auto
h-64
bg-gray-200
text-gray-500
w-1/4
pl-4
mt-6
fixed
pr-2
pl-1
bg-blue-600
bottom-0
right-0
mr-4
mb-4
text-blue-100
hover:bg-blue-600
h-6
w-6
bg-blue-500
w-4
h-4
70 steps to create a social feed component with Tailwind CSS
Use
flex
to create a block-level flex container.Use
w-screen
to make an element span the entire width of the viewport.Use
h-screen
to make an element span the entire height of the viewport.Control the horizontal padding of an element to 1rem using the
px-4
utilities.Control the text color of an element to gray-700 using the
text-gray-700
utilities.Use
w-full
to set an element to a 100% based width.Set the maximum width/height of an element using the
max-w-screen-lg
utilities.Use
flex
to create a block-level flex container.Use
w-64
to set an element to a fixed width(16rem).Control the vertical padding of an element to 1rem using the
py-4
utilities.Control the padding on right side of an element to 0.75rem using the
pr-3
utilities.Control the horizontal padding of an element to 0.75rem using the
px-3
utilities.Control the vertical padding of an element to 0.5rem using the
py-2
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 lg using the
text-lg
utilities.Control the background color of an element to gray-300 using the
hover:bg-gray-300
utilities on hover.Control the margin on top side of an element to auto using the
mt-auto
utilities.Control the background color of an element to gray-200 using the
hover:bg-gray-200
utilities on hover.Use
flex
to create a block-level flex container.Use
w-10
to set an element to a fixed width(2.5rem).Use
h-10
to set an element to a fixed height(2.5rem).Control the background color of an element to gray-400 using the
bg-gray-400
utilities.Control the margin on left side of an element to 0.5rem using the
ml-2
utilities.Control the margin on top side of an element to 0.25rem using the
mt-1
utilities.Control the text color of an element to sm using the
text-sm
utilities.Control the text color of an element to xs using the
text-xs
utilities.Use
flex
to create a block-level flex container.Control the border color of an element to l using the
border-l
utilities.Control the border color of an element to r using the
border-r
utilities.Control the border color of an element to gray-300 using the
border-gray-300
utilities.Control the horizontal padding of an element to 2rem using the
px-8
utilities.Control the border color of an element to b using the
border-b
utilities.Control the text color of an element to xl using the
text-xl
utilities.Use
h-8
to set an element to a fixed height(2rem).Control the horizontal padding of an element to 0.5rem using the
px-2
utilities.Control the background color of an element to gray-300 using the
bg-gray-300
utilities.Control the background color of an element to gray-400 using the
hover:bg-gray-400
utilities on hover.Use
h-0
to set an element to a fixed height(0rem).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.Control the padding on all sides of an element to 2rem using the
p-8
utilities.Control the border color of an element to b-4 using the
border-b-4
utilities.Use
w-12
to set an element to a fixed width(3rem).Use
h-12
to set an element to a fixed height(3rem).Control the margin on left side of an element to 1rem using the
ml-4
utilities.Control the padding on all sides of an element to 0.75rem using the
p-3
utilities.Control the background color of an element to transparent using the
bg-transparent
utilities.Control the border color of an element to gray-500 using the
border-gray-500
utilities.Control the margin on left side of an element to 0.25rem using the
ml-1
utilities.Control the margin on left side of an element to auto using the
ml-auto
utilities.Use
h-64
to set an element to a fixed height(16rem).Control the background color of an element to gray-200 using the
bg-gray-200
utilities.Control the text color of an element to gray-500 using the
text-gray-500
utilities.Use
w-1/4
to set an element to a fixed width(1/4).Adjust the left padding of an element to 1rem using the
pl-4
utilities classControl the margin on top side of an element to 1.5rem using the
mt-6
utilities.Use
fixed
to position an element relative to the browser window.Control the padding on right side of an element to 0.5rem using the
pr-2
utilities.Adjust the left padding of an element to 0.25rem using the
pl-1
utilities classControl the background color of an element to blue-600 using the
bg-blue-600
utilities.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 right side of an element to 1rem using the
mr-4
utilities.Control the margin on bottom side of an element to 1rem using the
mb-4
utilities.Control the text color of an element to blue-100 using the
text-blue-100
utilities.Control the background color of an element to blue-600 using the
hover:bg-blue-600
utilities on hover.Use
h-6
to set an element to a fixed height(1.5rem).Use
w-6
to set an element to a fixed width(1.5rem).Control the background color of an element to blue-500 using the
bg-blue-500
utilities.Use
w-4
to set an element to a fixed width(1rem).Use
h-4
to set an element to a fixed height(1rem).
Conclusion
The above is a step-by-step tutorial on how to use Tailwind CSS to create a social feed components, learn and follow along to implement your own components.