- Published on
What You Need To Build A Dashboard Metrics - Default With Tailwind CSS

- What is Tailwind CSS?
- The description of Dashboard Metrics - Default ui component
- Why use Tailwind CSS to create a Dashboard Metrics - Default ui component?
- The preview of Dashboard Metrics - Default ui component
- The source code of Dashboard Metrics - Default ui component
- How to create a Dashboard Metrics - Default with Tailwind CSS?
- Install tailwind css of verion 2.0.3
- All the unility class needed to create a Dashboard Metrics - Default component
- 34 steps to create a Dashboard Metrics - Default 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 Metrics - Default ui component
Dashboard metrics - default component by web3templates
Why use Tailwind CSS to create a Dashboard Metrics - Default ui component?
- It can make the building process of Dashboard Metrics - Default ui component faster and more easily.
- Enables building complex responsive layouts and components freely.
- Minimum lines of CSS code in Dashboard Metrics - Default component file.
The preview of Dashboard Metrics - Default ui component
Free download of the Dashboard Metrics - Default's source code
The source code of Dashboard Metrics - Default ui component
<!--
=======================================================================
Name : Dashboard Metrics - Default
Author : Surjith S M
Twitter : @surjithctly
Other Variations Available: Stacked, Minimal, with icons
Get more components here 👉 https://web3templates.com/components
Copyright © 2021
=======================================================================
-->
<div class="flex items-center min-h-screen bg-gray-50 dark:bg-gray-900">
<div class="container max-w-6xl px-5 mx-auto my-28">
<div class="grid gap-7 sm:grid-cols-2 lg:grid-cols-4">
<div class="p-5 bg-white rounded shadow-sm">
<div class="text-base text-gray-400 ">Total Sales</div>
<div class="flex items-center pt-1">
<div class="text-2xl font-bold text-gray-900 ">$9850.90</div>
<span class="flex items-center px-2 py-0.5 mx-2 text-sm text-green-600 bg-green-100 rounded-full">
<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M18 15L12 9L6 15" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
</svg>
<span>1.8%</span>
</span>
</div>
</div>
<div class="p-5 bg-white rounded shadow-sm">
<div class="text-base text-gray-400 ">Net Revenue</div>
<div class="flex items-center pt-1">
<div class="text-2xl font-bold text-gray-900 ">$7520.50</div>
<span class="flex items-center px-2 py-0.5 mx-2 text-sm text-red-600 bg-red-100 rounded-full">
<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6 9L12 15L18 9" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
</svg>
<span>2.5%</span>
</span>
</div>
</div>
<div class="p-5 bg-white rounded shadow-sm">
<div class="text-base text-gray-400 ">Customers</div>
<div class="flex items-center pt-1">
<div class="text-2xl font-bold text-gray-900 ">1375</div>
<span class="flex items-center px-2 py-0.5 mx-2 text-sm text-green-600 bg-green-100 rounded-full">
<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M18 15L12 9L6 15" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
</svg>
<span>5.2%</span>
</span>
</div>
</div>
<div class="p-5 bg-white rounded shadow-sm">
<div class="text-base text-gray-400 ">MRR</div>
<div class="flex items-center pt-1">
<div class="text-2xl font-bold text-gray-900 ">$250.00</div>
<span class="flex items-center px-2 py-0.5 mx-2 text-sm text-green-600 bg-green-100 rounded-full">
<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M18 15L12 9L6 15" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
</svg>
<span>2.2%</span>
</span>
</div>
</div>
</div>
</div>
</div>
<!-- Footer Mentions -->
<div class="fixed bottom-5 w-full text-center text-gray-400">
Crafted with ♡ by <a class="text-blue-500" target="_blank" href="https://web3templates.com/components/">Web3Templates</a>
</div>
How to create a Dashboard Metrics - Default 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 create a Dashboard Metrics - Default component
flex
min-h-screen
bg-gray-50
dark:bg-gray-900
max-w-6xl
px-5
mx-auto
my-28
grid
gap-7
sm:grid-cols-2
lg:grid-cols-4
p-5
bg-white
text-base
text-gray-400
pt-1
text-2xl
text-gray-900
px-2
py-0.5
mx-2
text-sm
text-green-600
bg-green-100
w-4
h-4
text-red-600
bg-red-100
fixed
bottom-5
w-full
text-center
text-blue-500
34 steps to create a Dashboard Metrics - Default component with Tailwind CSS
Use
flex
to create a block-level flex container.Set the minimum width/height of an element using the
min-h-screen
utilities.Control the background color of an element to gray-50 using the
bg-gray-50
utilities.Control the background color of an element to gray-900 using the
dark:bg-gray-900
utilities in dark theme.Set the maximum width/height of an element using the
max-w-6xl
utilities.Control the horizontal padding of an element to 1.25rem using the
px-5
utilities.Control the horizontal margin of an element to auto using the
mx-auto
utilities.Control the vertical margin of an element to 7rem using the
my-28
utilities.Use
grid
to create a grid container.To specify the width between columns, you can use the
gap-7
utilities.Use
grid
to create a grid container at only small screen sizes.Use
grid
to create a grid container at only large screen sizes.Control the padding on all sides of an element to 1.25rem using the
p-5
utilities.Control the background color of an element to white using the
bg-white
utilities.Control the text color of an element to base using the
text-base
utilities.Control the text color of an element to gray-400 using the
text-gray-400
utilities.Control the padding on top side of an element to 0.25rem using the
pt-1
utilities.Control the text color of an element to 2xl using the
text-2xl
utilities.Control the text color of an element to gray-900 using the
text-gray-900
utilities.Control the horizontal padding of an element to 0.5rem using the
px-2
utilities.Control the vertical padding of an element to 0.5 using the
py-0.5
utilities.Control the horizontal margin of an element to 0.5rem using the
mx-2
utilities.Control the text color of an element to sm using the
text-sm
utilities.Control the text color of an element to green-600 using the
text-green-600
utilities.Control the background color of an element to green-100 using the
bg-green-100
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 text color of an element to red-600 using the
text-red-600
utilities.Control the background color of an element to red-100 using the
bg-red-100
utilities.Use
fixed
to position an element relative to the browser window.Use the
bottom-5
utilities to set the bottom position of a positioned element to 1.25rem.Use
w-full
to set an element to a 100% based width.Control the text color of an element to center using the
text-center
utilities.Control the text color of an element to blue-500 using the
text-blue-500
utilities.
Conclusion
The above is a step-by-step tutorial on how to use Tailwind CSS to create a Dashboard Metrics - Default components, learn and follow along to implement your own components.