- Published on
Ways To Create A Dashboard With Tailwind CSS In 60 Minutes

- What is Tailwind CSS?
- The description of Dashboard ui component
- Why use Tailwind CSS to make a Dashboard ui component?
- The preview of Dashboard ui component
- The source code of Dashboard ui component
- How to make a Dashboard with Tailwind CSS?
- Install tailwind css of verion 2.2.4
- All the unility class needed to make a Dashboard component
- 91 steps to make a Dashboard 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 Dashboard ui component
Semoga bermanfaat untuk semua
Why use Tailwind CSS to make a Dashboard ui component?
- It can make the building process of Dashboard ui component faster and more easily.
- Enables building complex responsive layouts and components freely.
- Minimum lines of CSS code in Dashboard component file.
The preview of Dashboard ui component
Free download of the Dashboard's source code
The source code of Dashboard ui component
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Dashboard</title>
<link href="https://fonts.googleapis.com/css2?family=Inter:[email protected];500;600;700;800&display=swap"
rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"
rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"
rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/gh/alpinejs/[email protected]/dist/alpine.min.js" defer></script>
</head>
<body >
<div class="flex h-screen w-full bg-gray-800 " x-data="{openMenu:1}">
<!--Start SideBar-->
<aside class="w-20 relative z-20 flex-shrink-0 px-2 overflow-y-auto bg-indigo-600 sm:block">
<div class="mb-6">
<!--Start logo -->
<div class="flex justify-center">
<div class="w-14 h-14 rounded-full bg-gray-300 border-2 border-white mt-2">
<img
src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQVxhAxJ4D7MOeTTj6kR9PBeZonW5HM7giKjTbEmR-HMBwf3G1VqGnlwpO1kWrdyIZu8_U&usqp=CAU"
class="rounded-full w-auto"
/>
</div>
</div>
<!--End logo -->
<!--Start NavItem -->
<div>
<ul class="mt-6 leading-10 px-4">
<li class="mb-3 p-2 rounded-md flex items-center justify-center bg-blue-400 cursor-pointer"
@click="openMenu !== 1 ? openMenu = 1 : openMenu = null"
>
<i class="fas fa-align-left fa-sm text-white"></i>
</li>
<li class="mb-3 p-2 rounded-md flex items-center justify-center bg-pink-400 cursor-pointer">
<i class="fas fa-question-circle fa-sm text-white"></i>
</li>
<li class="mb-3 p-2 rounded-md flex items-center justify-center bg-yellow-400 cursor-pointer">
<i class="fas fa-headphones fa-sm text-white"></i>
</li>
<li class="absolute bottom-0 mb-3 p-2 rounded-full flex items-center mx-auto bg-white cursor-pointer">
<i class="fas fa-power-off fa-sm text-indigo-600"></i>
</li>
</ul>
</div>
<!--End NavItem -->
</div>
</aside>
<!-- Start Open Menu -->
<aside class="animate__animated animate__fadeInLeft w-52 relative z-0 flex-shrink-0 hidden px-4 overflow-y-auto bg-gray-100 sm:block "
x-show="openMenu == 1"
@click.away="openMenu = null"
style="display: none;">
<div class="mb-6">
<!--Start Sidebar for open menu -->
<div class="grid grid-cols-1 gap-4 grid-cols-2 mt-6">
<!-- Start Navitem -->
<div class="p-2 flex flex-col items-center bg-white rounded-md justify-center shadow-xl cursor-pointer">
<div class="rounded-full p-2 bg-indigo-200 flex flex-col items-center">
<i class="fas fa-chart-pie fa-sm text-indigo-600"></i>
</div>
<p class="text-xs mt-1 text-center font-semibold">Dashboard</p>
</div>
<!-- End Navitem -->
<!-- Start Navitem -->
<div class="p-2 flex flex-col items-center bg-white rounded-md justify-center shadow-xl cursor-pointer">
<div class="rounded-full p-2 bg-indigo-200 flex flex-col items-center">
<i class="fas fa-calculator fa-sm text-indigo-600"></i>
</div>
<p class="text-xs mt-1 text-center font-semibold">Calculator</p>
</div>
<!-- End Navitem -->
<!-- Start Navitem -->
<div class="p-2 flex flex-col items-center bg-white rounded-md justify-center shadow-xl cursor-pointer">
<div class="rounded-full p-2 bg-indigo-200 flex flex-col items-center">
<i class="fas fa-wallet fa-sm text-indigo-600"></i>
</div>
<p class="text-xs mt-1 text-center font-semibold">Wallet</p>
</div>
<!-- End Navitem -->
<!-- Start Navitem -->
<div class="p-2 flex flex-col items-center bg-white rounded-md justify-center shadow-xl cursor-pointer">
<div class="rounded-full p-2 bg-indigo-200 flex flex-col items-center">
<i class="fas fa-archive fa-sm text-indigo-600"></i>
</div>
<p class="text-xs mt-1 text-center font-semibold">Saving</p>
</div>
<!-- End Navitem -->
<!-- Start Navitem -->
<div class="p-2 flex flex-col items-center bg-white rounded-md justify-center shadow-xl cursor-pointer">
<div class="rounded-full p-2 bg-indigo-200 flex flex-col items-center">
<i class="fas fa-money-bill-wave-alt fa-sm text-indigo-600"></i>
</div>
<p class="text-xs mt-1 text-center font-semibold">Currencies</p>
</div>
<!-- End Navitem -->
<!-- Start Navitem -->
<div class="p-2 flex flex-col items-center bg-white rounded-md justify-center shadow-xl cursor-pointer">
<div class="rounded-full p-2 bg-indigo-200 flex flex-col items-center">
<i class="fas fa-shopping-basket fa-sm text-indigo-600"></i>
</div>
<p class="text-xs mt-1 text-center font-semibold">Expenses</p>
</div>
<!-- End Navitem -->
</div>
<!--End Sidebar for open menu -->
</div>
</aside>
<!-- End Open Menu -->
<!-- End Sidebar -->
<div class="flex flex-col flex-1 w-full overflow-y-auto">
<!--Start Topbar -->
<!--End Topbar -->
<main class="relative z-0 flex-1 pb-8 px-6 bg-white">
<div class="grid pb-10 mt-4 ">
<!-- Start Content-->
<div class="mb-2">
<p class="text-lg font-semibold text-gray-400">Invoices</p>
</div>
<div class="grid grid-cols-12 gap-6 border-b-2 pb-5">
<div class="col-span-12 sm:col-span-12 md:col-span-8 lg:col-span-8 xxl:col-span-8">
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2 md:grid-cols-4 lg:grid-cols-4 xl:grid-cols-4 mt-3">
<div class="p-4">
<p class="text-xl font-bold">RM 45,941</p>
<p class="text-xs font-semibold text-gray-400">Overdue</p>
</div>
<div class="p-4">
<p class="text-xl font-bold">RM 37,500</p>
<p class="text-xs font-semibold text-gray-400">Total Outstanding</p>
</div>
<div class="p-4">
<p class="text-xl font-bold">RM 9,200</p>
<p class="text-xs font-semibold text-gray-400">In Process</p>
</div>
<div class=" p-4">
<p class="text-xl font-bold">RM 5,700</p>
<p class="text-xs font-semibold text-gray-400">Paid Today</p>
</div>
</div>
</div>
<div class="col-span-12 sm:col-span-12 md:col-span-4 lg:col-span-4 xxl:col-span-4">
<div class="p-4">
<p class="text-sm text-gray-400">Outstanding Revenue</p>
<div class="shadow w-full bg-gray-100 mt-2">
<div class="bg-indigo-600 text-xs leading-none py-1 text-center text-white" style="width: 55%"></div>
</div>
<p class="text-xs font-semibold text-gray-400 mt-2">RM 45,941 Overdue</p>
</div>
</div>
</div>
<div class="grid grid-cols-1 gap-2 sm:grid-cols-1 md:grid-cols-3 lg:grid-cols-3 xl:grid-cols-3 mt-3">
<div class="relative w-full h-52 bg-cover bg-center group rounded-lg overflow-hidden shadow-lg transition duration-300 ease-in-out"
style="background-image: url('https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/f868ecef-4b4a-4ddf-8239-83b2568b3a6b/de7hhu3-3eae646a-9b2e-4e42-84a4-532bff43f397.jpg?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOjdlMGQxODg5ODIyNjQzNzNhNWYwZDQxNWVhMGQyNmUwIiwiaXNzIjoidXJuOmFwcDo3ZTBkMTg4OTgyMjY0MzczYTVmMGQ0MTVlYTBkMjZlMCIsIm9iaiI6W1t7InBhdGgiOiJcL2ZcL2Y4NjhlY2VmLTRiNGEtNGRkZi04MjM5LTgzYjI1NjhiM2E2YlwvZGU3aGh1My0zZWFlNjQ2YS05YjJlLTRlNDItODRhNC01MzJiZmY0M2YzOTcuanBnIn1dXSwiYXVkIjpbInVybjpzZXJ2aWNlOmZpbGUuZG93bmxvYWQiXX0.R0h-BS0osJSrsb1iws4-KE43bUXHMFvu5PvNfoaoi8o');">
<div class="absolute inset-0 bg-pink-900 bg-opacity-75 transition duration-300 ease-in-out"></div>
<div class="relative w-full h-full px-4 sm:px-6 lg:px-4 flex items-center justify-center">
<div>
<h3 class="text-center text-white text-lg">
Total Balance
</h3>
<h3 class="text-center text-white text-3xl mt-2 font-bold">
RM 27,580
</h3>
<div class="flex space-x-4 mt-4">
<button class="block uppercase mx-auto shadow bg-white text-indigo-600 focus:shadow-outline
focus:outline-none text-white text-xs py-3 px-4 rounded font-bold">
Transfer
</button>
<button class="block uppercase mx-auto shadow bg-indigo-800 hover:bg-indigo-700 focus:shadow-outline
focus:outline-none text-white text-xs py-3 px-4 rounded font-bold">
Request
</button>
</div>
</div>
</div>
</div>
<div class="relative w-full h-52 bg-cover bg-center group rounded-lg overflow-hidden shadow-lg transition duration-300 ease-in-out"
style="background-image: url('https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/f868ecef-4b4a-4ddf-8239-83b2568b3a6b/de7hhu3-3eae646a-9b2e-4e42-84a4-532bff43f397.jpg?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOjdlMGQxODg5ODIyNjQzNzNhNWYwZDQxNWVhMGQyNmUwIiwiaXNzIjoidXJuOmFwcDo3ZTBkMTg4OTgyMjY0MzczYTVmMGQ0MTVlYTBkMjZlMCIsIm9iaiI6W1t7InBhdGgiOiJcL2ZcL2Y4NjhlY2VmLTRiNGEtNGRkZi04MjM5LTgzYjI1NjhiM2E2YlwvZGU3aGh1My0zZWFlNjQ2YS05YjJlLTRlNDItODRhNC01MzJiZmY0M2YzOTcuanBnIn1dXSwiYXVkIjpbInVybjpzZXJ2aWNlOmZpbGUuZG93bmxvYWQiXX0.R0h-BS0osJSrsb1iws4-KE43bUXHMFvu5PvNfoaoi8o');">
<div class="absolute inset-0 bg-yellow-600 bg-opacity-75 transition duration-300 ease-in-out"></div>
<div class="relative w-full h-full px-4 sm:px-6 lg:px-4 flex items-center">
<div>
<div class="text-white text-lg flex space-x-2 items-center">
<div class="bg-white rounded-md p-2 flex items-center">
<i class="fas fa-toggle-off fa-sm text-yellow-300"></i>
</div>
<p>Finished Appt</p>
</div>
<h3 class="text-white text-3xl mt-2 font-bold">
120
</h3>
<h3 class="text-white text-lg mt-2 text-yellow-100 ">
4 not confirmed
</h3>
</div>
</div>
</div>
<div class="relative w-full h-52 bg-cover bg-center group rounded-lg overflow-hidden shadow-lg transition duration-300 ease-in-out"
style="background-image: url('https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/f868ecef-4b4a-4ddf-8239-83b2568b3a6b/de7hhu3-3eae646a-9b2e-4e42-84a4-532bff43f397.jpg?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOjdlMGQxODg5ODIyNjQzNzNhNWYwZDQxNWVhMGQyNmUwIiwiaXNzIjoidXJuOmFwcDo3ZTBkMTg4OTgyMjY0MzczYTVmMGQ0MTVlYTBkMjZlMCIsIm9iaiI6W1t7InBhdGgiOiJcL2ZcL2Y4NjhlY2VmLTRiNGEtNGRkZi04MjM5LTgzYjI1NjhiM2E2YlwvZGU3aGh1My0zZWFlNjQ2YS05YjJlLTRlNDItODRhNC01MzJiZmY0M2YzOTcuanBnIn1dXSwiYXVkIjpbInVybjpzZXJ2aWNlOmZpbGUuZG93bmxvYWQiXX0.R0h-BS0osJSrsb1iws4-KE43bUXHMFvu5PvNfoaoi8o');">
<div class="absolute inset-0 bg-blue-900 bg-opacity-75 transition duration-300 ease-in-out"></div>
<div class="relative w-full h-full px-4 sm:px-6 lg:px-4 flex items-center">
<div>
<div class="text-white text-lg flex space-x-2 items-center">
<div class="bg-white rounded-md p-2 flex items-center">
<i class="fas fa-clipboard-check fa-sm text-blue-800"></i>
</div>
<p>Finished Appt</p>
</div>
<h3 class="text-white text-3xl mt-2 font-bold">
72
</h3>
<h3 class="text-white text-lg mt-2 ">
3.4% <span class='font-semibold text-blue-200'>vs last month</span>
</h3>
</div>
</div>
</div>
</div>
<!-- End Content-->
</div>
</main>
</div>
</div>
</body>
How to make a Dashboard with Tailwind CSS?
Install tailwind css of verion 2.2.4
Use the script
html tag to import the script of Tailwind CSS of the version 2.2.4
<script src="https://cdn.tailwindcss.com"></script>
All the unility class needed to make a Dashboard component
flex
h-screen
w-full
bg-gray-800
w-20
relative
z-20
flex-shrink-0
px-2
overflow-y-auto
bg-indigo-600
sm:block
mb-6
w-14
h-14
bg-gray-300
border-2
border-white
mt-2
w-auto
mt-6
px-4
mb-3
p-2
bg-blue-400
text-white
bg-pink-400
bg-yellow-400
absolute
bottom-0
mx-auto
bg-white
text-indigo-600
w-52
z-0
hidden
bg-gray-100
grid
grid-cols-1
gap-4
grid-cols-2
flex-col
bg-indigo-200
text-xs
mt-1
text-center
flex-1
pb-8
px-6
pb-10
mt-4
mb-2
text-lg
text-gray-400
grid-cols-12
gap-6
border-b-2
pb-5
gap-2
sm:grid-cols-2
md:grid-cols-4
lg:grid-cols-4
xl:grid-cols-4
mt-3
p-4
text-xl
text-sm
py-1
sm:grid-cols-1
md:grid-cols-3
lg:grid-cols-3
xl:grid-cols-3
h-52
bg-cover
bg-center
overflow-hidden
bg-pink-900
bg-opacity-75
h-full
sm:px-6
lg:px-4
text-3xl
block
py-3
bg-indigo-800
hover:bg-indigo-700
bg-yellow-600
text-yellow-300
text-yellow-100
bg-blue-900
text-blue-800
91 steps to make a Dashboard 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.Use
w-full
to set an element to a 100% based width.Control the background color of an element to gray-800 using the
bg-gray-800
utilities.Use
w-20
to set an element to a fixed width(5rem).Use
relative
to position an element according to the normal flow of the document.Control the stack order (or three-dimensional positioning) of an element to 20 in Tailwind, regardless of order it has been displayed, using the
z-20
utilities.Use
flex
to create a block-level flex container.Control the horizontal padding of an element to 0.5rem using the
px-2
utilities.Use
overflow-y-auto
to allow vertical scrolling if needed.Control the background color of an element to indigo-600 using the
bg-indigo-600
utilities.Use
inline
utilities to put the element on its own line and fill its parent at only small screen sizes.Control the margin on bottom side of an element to 1.5rem using the
mb-6
utilities.Use
w-14
to set an element to a fixed width(3.5rem).Use
h-14
to set an element to a fixed height(3.5rem).Control the background color of an element to gray-300 using the
bg-gray-300
utilities.Control the border color of an element to 0.5rem using the
border-2
utilities.Control the border color of an element to white using the
border-white
utilities.Control the margin on top side of an element to 0.5rem using the
mt-2
utilities.The
w-auto
utility can be useful if you need to remove an element’s assigned width under a specific condition, like at a particular breakpoint.Control the margin on top side of an element to 1.5rem using the
mt-6
utilities.Control the horizontal padding of an element to 1rem using the
px-4
utilities.Control the margin on bottom side of an element to 0.75rem using the
mb-3
utilities.Control the padding on all sides of an element to 0.5rem using the
p-2
utilities.Control the background color of an element to blue-400 using the
bg-blue-400
utilities.Control the text color of an element to white using the
text-white
utilities.Control the background color of an element to pink-400 using the
bg-pink-400
utilities.Control the background color of an element to yellow-400 using the
bg-yellow-400
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.Control the horizontal margin of an element to auto using the
mx-auto
utilities.Control the background color of an element to white using the
bg-white
utilities.Control the text color of an element to indigo-600 using the
text-indigo-600
utilities.Use
w-52
to set an element to a fixed width(13rem).Control the stack order (or three-dimensional positioning) of an element to 0 in Tailwind, regardless of order it has been displayed, using the
z-0
utilities.Use
hidden
to set an element to display: none and remove it from the page layout.Control the background color of an element to gray-100 using the
bg-gray-100
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-4
utilities.Use
grid
to create a grid container.Use
flex
to create a block-level flex container.Control the background color of an element to indigo-200 using the
bg-indigo-200
utilities.Control the text color of an element to xs using the
text-xs
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 center using the
text-center
utilities.Use
flex
to create a block-level flex container.Control the padding on bottom side of an element to 2rem using the
pb-8
utilities.Control the horizontal padding of an element to 1.5rem using the
px-6
utilities.Control the padding on bottom side of an element to 2.5rem using the
pb-10
utilities.Control the margin on top side of an element to 1rem using the
mt-4
utilities.Control the margin on bottom side of an element to 0.5rem using the
mb-2
utilities.Control the text color of an element to lg using the
text-lg
utilities.Control the text color of an element to gray-400 using the
text-gray-400
utilities.Use
grid
to create a grid container.To specify the width between columns, you can use the
gap-6
utilities.Control the border color of an element to b-2 using the
border-b-2
utilities.Control the padding on bottom side of an element to 1.25rem using the
pb-5
utilities.To specify the width between columns, you can use the
gap-2
utilities.Use
grid
to create a grid container at only small screen sizes.Use
grid
to create a grid container at only medium screen sizes.Use
grid
to create a grid container at only large screen sizes.Use
grid
to create a grid container at only extremely large screen sizes.Control the margin on top side of an element to 0.75rem using the
mt-3
utilities.Control the padding on all sides of an element to 1rem using the
p-4
utilities.Control the text color of an element to xl using the
text-xl
utilities.Control the text color of an element to sm using the
text-sm
utilities.Control the vertical padding of an element to 0.25rem using the
py-1
utilities.Use
grid
to create a grid container at only small screen sizes.Use
grid
to create a grid container at only medium screen sizes.Use
grid
to create a grid container at only large screen sizes.Use
grid
to create a grid container at only extremely large screen sizes.Use
h-52
to set an element to a fixed height(13rem).Control the background color of an element to cover using the
bg-cover
utilities.Control the background color of an element to center using the
bg-center
utilities.Use
overflow-hidden
to clip any content within an element that overflows the bounds of that element.Control the background color of an element to pink-900 using the
bg-pink-900
utilities.Control the background color of an element to opacity-75 using the
bg-opacity-75
utilities.Use
h-full
to set an element’s height to 100% of its parent, as long as the parent has a defined height.Control the horizontal padding of an element to 1.5rem at only small screen sizes using the
sm:px-6
utilities.Control the horizontal padding of an element to 1rem at only large screen sizes using the
lg:px-4
utilities.Control the text color of an element to 3xl using the
text-3xl
utilities.Use
inline
utilities to put the element on its own line and fill its parent.Control the vertical padding of an element to 0.75rem using the
py-3
utilities.Control the background color of an element to indigo-800 using the
bg-indigo-800
utilities.Control the background color of an element to indigo-700 using the
hover:bg-indigo-700
utilities on hover.Control the background color of an element to yellow-600 using the
bg-yellow-600
utilities.Control the text color of an element to yellow-300 using the
text-yellow-300
utilities.Control the text color of an element to yellow-100 using the
text-yellow-100
utilities.Control the background color of an element to blue-900 using the
bg-blue-900
utilities.Control the text color of an element to blue-800 using the
text-blue-800
utilities.
Conclusion
The above is a step-by-step tutorial on how to use Tailwind CSS to make a Dashboard components, learn and follow along to implement your own components.