- Published on
6 Steps To Create A Follow A Members With Tailwind CSS Like A Pro In Under An Hour

- What is Tailwind CSS?
- The description of Follow a members ui component
- Why use Tailwind CSS to make a Follow a members ui component?
- The preview of Follow a members ui component
- The source code of Follow a members ui component
- How to make a Follow a members with Tailwind CSS?
- Install tailwind css of verion 3.0.18
- All the unility class needed to make a Follow a members component
- 34 steps to make a Follow a members 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 Follow a members ui component
Card with a list of users and with a follower button that when pressed an alert is displayed. full example in codepen pure css, ( not tailwind ) here 👉 codepen.io/frankuxui/pen/rnyljlg || share my work if you like ❤
Why use Tailwind CSS to make a Follow a members ui component?
- It can make the building process of Follow a members ui component faster and more easily.
- Enables building complex responsive layouts and components freely.
- Minimum lines of CSS code in Follow a members component file.
The preview of Follow a members ui component
Free download of the Follow a members's source code
The source code of Follow a members ui component
<link href="https://fonts.googleapis.com/css2?family=Roboto:[email protected];400;500;700;900&display=swap" rel="stylesheet" />
<style>
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700;900&display=swap");
body{
font-family: "Roboto", sans-serif;
}
</style>
<!-- This is an example component -->
<div class='flex flex-col items-center justify-center min-h-screen p-16 bg-slate-200'>
<h1 class="my-10 font-medium text-3xl sm:text-4xl font-black">
Follow a Members
<span class="day" style="display: inline-block">😎</span>
<span class="night" style="display: none">👀</span>
</h1>
<div class="mb-4">
<button class="toggle-theme btn inline-block select-none no-underline align-middle cursor-pointer whitespace-nowrap px-4 py-1.5 rounded text-base font-medium leading-6 tracking-tight text-white text-center border-0 bg-[#6911e7] hover:bg-[#590acb] duration-300" type="button">Dark</button>
</div>
<div class='user-list w-full max-w-lg mx-auto bg-white rounded-xl shadow-xl flex flex-col py-4'>
<!--User row -->
<div class="user-row flex flex-col items-center justify-between cursor-pointer p-4 duration-300 sm:flex-row sm:py-4 sm:px-8 hover:bg-[#f6f8f9]">
<div class="user flex items-center text-center flex-col sm:flex-row sm:text-left">
<div class="avatar-content mb-2.5 sm:mb-0 sm:mr-2.5">
<img class="avatar w-20 h-20 rounded-full" src="https://randomuser.me/api/portraits/men/32.jpg"/>
</div>
<div class="user-body flex flex-col mb-4 sm:mb-0 sm:mr-4">
<a href="#" class="title font-medium no-underline">Wade Warren</a>
<div class="skills flex flex-col">
<span class="subtitle text-slate-500">Marketing Liaison</span>
<span class="subtitle text-slate-500">Coordinator 💪</span>
</div>
</div>
</div>
<!--Button content -->
<div class="user-option mx-auto sm:ml-auto sm:mr-0">
<button class="btn inline-block select-none no-underline align-middle cursor-pointer whitespace-nowrap px-4 py-1.5 rounded text-base font-medium leading-6 tracking-tight text-white text-center border-0 bg-[#6911e7] hover:bg-[#590acb] duration-300" type="button">Follow</button>
</div>
<!--Close Button content -->
</div>
<!--User row -->
<!--User row -->
<div class="user-row flex flex-col items-center justify-between cursor-pointer p-4 duration-300 sm:flex-row sm:py-4 sm:px-8 hover:bg-[#f6f8f9]">
<div class="user flex items-center text-center flex-col sm:flex-row sm:text-left">
<div class="avatar-content mb-2.5 sm:mb-0 sm:mr-2.5">
<img class="avatar w-20 h-20 rounded-full" src="https://randomuser.me/api/portraits/women/44.jpg"/>
</div>
<div class="user-body flex flex-col mb-4 sm:mb-0 sm:mr-4">
<a href="#" class="title font-medium no-underline">Loura Weber</a>
<div class="skills flex flex-col">
<span class="subtitle text-slate-500">Lead Manager</span>
<span class="subtitle text-slate-500">Confidence</span>
</div>
</div>
</div>
<!--Button content -->
<div class="user-option mx-auto sm:ml-auto sm:mr-0">
<button class="btn inline-block select-none no-underline align-middle cursor-pointer whitespace-nowrap px-4 py-1.5 rounded text-base font-medium leading-6 tracking-tight text-white text-center border-0 bg-[#6911e7] hover:bg-[#590acb] duration-300" type="button">Follow</button>
</div>
<!--Close Button content -->
</div>
<!--User row -->
<!--User row -->
<div class="user-row flex flex-col items-center justify-between cursor-pointer p-4 duration-300 sm:flex-row sm:py-4 sm:px-8 hover:bg-[#f6f8f9]">
<div class="user flex items-center text-center flex-col sm:flex-row sm:text-left">
<div class="avatar-content mb-2.5 sm:mb-0 sm:mr-2.5">
<img class="avatar w-20 h-20 rounded-full" src="https://randomuser.me/api/portraits/men/46.jpg"/>
</div>
<div class="user-body flex flex-col mb-4 sm:mb-0 sm:mr-4">
<a href="#" class="title font-medium no-underline">Jane Cooper</a>
<div class="skills flex flex-col">
<span class="subtitle text-slate-500">Dog Trainer</span>
<span class="subtitle text-slate-500">Trainer</span>
</div>
</div>
</div>
<!--Button content -->
<div class="user-option mx-auto sm:ml-auto sm:mr-0">
<button class="btn inline-block select-none no-underline align-middle cursor-pointer whitespace-nowrap px-4 py-1.5 rounded text-base font-medium leading-6 tracking-tight text-white text-center border-0 bg-[#6911e7] hover:bg-[#590acb] duration-300" type="button">Follow</button>
</div>
<!--Close Button content -->
</div>
<!--User row -->
<!--User row -->
<div class="user-row flex flex-col items-center justify-between cursor-pointer p-4 duration-300 sm:flex-row sm:py-4 sm:px-8 hover:bg-[#f6f8f9]">
<div class="user flex items-center text-center flex-col sm:flex-row sm:text-left">
<div class="avatar-content mb-2.5 sm:mb-0 sm:mr-2.5">
<img class="avatar w-20 h-20 rounded-full" src="https://randomuser.me/api/portraits/men/47.jpg"/>
</div>
<div class="user-body flex flex-col mb-4 sm:mb-0 sm:mr-4">
<a href="#" class="title font-medium no-underline">Guy Hawkins</a>
<div class="skills flex flex-col">
<span class="subtitle text-slate-500">Medical Assistant</span>
<span class="subtitle text-slate-500">Assitant</span>
</div>
</div>
</div>
<!--Button content -->
<div class="user-option mx-auto sm:ml-auto sm:mr-0">
<button class="btn inline-block select-none no-underline align-middle cursor-pointer whitespace-nowrap px-4 py-1.5 rounded text-base font-medium leading-6 tracking-tight text-white text-center border-0 bg-[#6911e7] hover:bg-[#590acb] duration-300" type="button">Follow</button>
</div>
<!--Close Button content -->
</div>
<!--User row -->
<!--User row -->
<div class="user-row flex flex-col items-center justify-between cursor-pointer p-4 duration-300 sm:flex-row sm:py-4 sm:px-8 hover:bg-[#f6f8f9]">
<div class="user flex items-center text-center flex-col sm:flex-row sm:text-left">
<div class="avatar-content mb-2.5 sm:mb-0 sm:mr-2.5">
<img class="avatar w-20 h-20 rounded-full" src="https://randomuser.me/api/portraits/women/63.jpg"/>
</div>
<div class="user-body flex flex-col mb-4 sm:mb-0 sm:mr-4">
<a href="#" class="title font-medium no-underline">Julian Jill Brown</a>
<div class="skills flex flex-col">
<span class="subtitle text-slate-500">Web Designer</span>
<span class="subtitle text-slate-500">Work under pressure</span>
</div>
</div>
</div>
<!--Button content -->
<div class="user-option mx-auto sm:ml-auto sm:mr-0">
<button class="btn inline-block select-none no-underline align-middle cursor-pointer whitespace-nowrap px-4 py-1.5 rounded text-base font-medium leading-6 tracking-tight text-white text-center border-0 bg-[#6911e7] hover:bg-[#590acb] duration-300" type="button">Follow</button>
</div>
<!--Close Button content -->
</div>
<!--User row -->
<a class="show-more block w-10/12 mx-auto py-2.5 px-4 text-center no-underline rounded hover:bg-[#f6f8f9] font-medium duration-300" href="#/">Show more members</a>
</div>
</div>
How to make a Follow a members 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 make a Follow a members component
my-10
text-3xl
sm:text-4xl
mb-4
inline-block
px-4
py-1.5
text-base
text-white
text-center
border-0
bg-[#6911e7]
hover:bg-[#590acb]
flex
flex-col
p-4
sm:flex-row
sm:py-4
sm:px-8
hover:bg-[#f6f8f9]
sm:text-left
mb-2.5
sm:mb-0
sm:mr-2.5
w-20
h-20
sm:mr-4
text-slate-500
mx-auto
sm:ml-auto
sm:mr-0
block
w-10/12
py-2.5
34 steps to make a Follow a members component with Tailwind CSS
Control the vertical margin of an element to 2.5rem using the
my-10
utilities.Control the text color of an element to 3xl using the
text-3xl
utilities.Control the text color of an element to 4xl at only small screen sizes using the
sm:text-4xl
utilities.Control the margin on bottom side of an element to 1rem using the
mb-4
utilities.Use
inline-block
utilities to wrap the element to prevent the text inside from extending beyond its parent.Control the horizontal padding of an element to 1rem using the
px-4
utilities.Control the vertical padding of an element to 1.5 using the
py-1.5
utilities.Control the text color of an element to base using the
text-base
utilities.Control the text color of an element to white using the
text-white
utilities.Control the text color of an element to center using the
text-center
utilities.Control the border color of an element to 0rem using the
border-0
utilities.Control the background color of an element to [#6911e7] using the
bg-[#6911e7]
utilities.Control the background color of an element to [#590acb] using the
hover:bg-[#590acb]
utilities on hover.Use
flex
to create a block-level flex container.Use
flex
to create a block-level flex container.Control the padding on all sides of an element to 1rem using the
p-4
utilities.Use
flex
to create a block-level flex container at only small screen sizes.Control the vertical padding of an element to 1rem at only small screen sizes using the
sm:py-4
utilities.Control the horizontal padding of an element to 2rem at only small screen sizes using the
sm:px-8
utilities.Control the background color of an element to [#f6f8f9] using the
hover:bg-[#f6f8f9]
utilities on hover.Control the text color of an element to left at only small screen sizes using the
sm:text-left
utilities.Control the margin on bottom side of an element to 2.5 using the
mb-2.5
utilities.Control the margin on bottom side of an element to 0rem at only small screen sizes using the
sm:mb-0
utilities.Control the margin on right side of an element to 2.5 at only small screen sizes using the
sm:mr-2.5
utilities.Use
w-20
to set an element to a fixed width(5rem).Use
h-20
to set an element to a fixed height(5rem).Control the margin on right side of an element to 1rem at only small screen sizes using the
sm:mr-4
utilities.Control the text color of an element to slate-500 using the
text-slate-500
utilities.Control the horizontal margin of an element to auto using the
mx-auto
utilities.Control the margin on left side of an element to auto at only small screen sizes using the
sm:ml-auto
utilities.Control the margin on right side of an element to 0rem at only small screen sizes using the
sm:mr-0
utilities.Use
inline
utilities to put the element on its own line and fill its parent.Use
w-10/12
to set an element to a fixed width(10/12).Control the vertical padding of an element to 2.5 using the
py-2.5
utilities.
Conclusion
The above is a step-by-step tutorial on how to use Tailwind CSS to make a Follow a members components, learn and follow along to implement your own components.