- Published on
The 5 Really Obvious Ways To Make A User Avatar with presence indicator With Tailwind CSS Better That You Ever Did

- What is Tailwind CSS?
- The description of User Avatar with presence indicator ui component
- Why use Tailwind CSS to make a User Avatar with presence indicator ui component?
- The preview of User Avatar with presence indicator ui component
- The source code of User Avatar with presence indicator ui component
- How to make a User Avatar with presence indicator with Tailwind CSS?
- Install tailwind css of verion 2.0.3
- All the unility class needed to make a User Avatar with presence indicator component
- 14 steps to make a User Avatar with presence indicator 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 User Avatar with presence indicator ui component
User avatar component with status
Why use Tailwind CSS to make a User Avatar with presence indicator ui component?
- It can make the building process of User Avatar with presence indicator ui component faster and more easily.
- Enables building complex responsive layouts and components freely.
- Minimum lines of CSS code in User Avatar with presence indicator component file.
The preview of User Avatar with presence indicator ui component
Free download of the User Avatar with presence indicator's source code
The source code of User Avatar with presence indicator ui component
<div class="bg-gray-200 flex justify-center items-center relative rounded-full">
<!-- Heroicon `user` -->
<svg class="w-9 h-9 m-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" />
</svg>
<!-- active -->
<span class="w-4 h-4 bg-green-500 absolute bottom-0 right-0 rounded-full"></span>
<!-- sleep -->
<!-- <span class="w-4 h-4 bg-yellow-500 absolute bottom-0 right-0 rounded-full"></span> -->
<!-- away -->
<!-- <span class="w-4 h-4 bg-red-500 absolute bottom-0 right-0 rounded-full"></span> -->
</div>
How to make a User Avatar with presence indicator 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 make a User Avatar with presence indicator component
bg-gray-200
flex
relative
w-9
h-9
m-6
w-4
h-4
bg-green-500
absolute
bottom-0
right-0
bg-yellow-500
bg-red-500
14 steps to make a User Avatar with presence indicator component with Tailwind CSS
Control the background color of an element to gray-200 using the
bg-gray-200
utilities.Use
flex
to create a block-level flex container.Use
relative
to position an element according to the normal flow of the document.Use
w-9
to set an element to a fixed width(2.25rem).Use
h-9
to set an element to a fixed height(2.25rem).Control the margin on all sides of an element to 1.5rem using the
m-6
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).Control the background color of an element to green-500 using the
bg-green-500
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 background color of an element to yellow-500 using the
bg-yellow-500
utilities.Control the background color of an element to red-500 using the
bg-red-500
utilities.
Conclusion
The above is a step-by-step tutorial on how to use Tailwind CSS to make a User Avatar with presence indicator components, learn and follow along to implement your own components.