Published on

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

Tags
Dashboard Metrics - Default

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

  1. Use flex to create a block-level flex container.

  2. Set the minimum width/height of an element using the min-h-screen utilities.

  3. Control the background color of an element to gray-50 using the bg-gray-50 utilities.

  4. Control the background color of an element to gray-900 using the dark:bg-gray-900 utilities in dark theme.

  5. Set the maximum width/height of an element using the max-w-6xl utilities.

  6. Control the horizontal padding of an element to 1.25rem using the px-5 utilities.

  7. Control the horizontal margin of an element to auto using the mx-auto utilities.

  8. Control the vertical margin of an element to 7rem using the my-28 utilities.

  9. Use grid to create a grid container.

  10. To specify the width between columns, you can use the gap-7 utilities.

  11. Use grid to create a grid container at only small screen sizes.

  12. Use grid to create a grid container at only large screen sizes.

  13. Control the padding on all sides of an element to 1.25rem using the p-5 utilities.

  14. Control the background color of an element to white using the bg-white utilities.

  15. Control the text color of an element to base using the text-base utilities.

  16. Control the text color of an element to gray-400 using the text-gray-400 utilities.

  17. Control the padding on top side of an element to 0.25rem using the pt-1 utilities.

  18. Control the text color of an element to 2xl using the text-2xl utilities.

  19. Control the text color of an element to gray-900 using the text-gray-900 utilities.

  20. Control the horizontal padding of an element to 0.5rem using the px-2 utilities.

  21. Control the vertical padding of an element to 0.5 using the py-0.5 utilities.

  22. Control the horizontal margin of an element to 0.5rem using the mx-2 utilities.

  23. Control the text color of an element to sm using the text-sm utilities.

  24. Control the text color of an element to green-600 using the text-green-600 utilities.

  25. Control the background color of an element to green-100 using the bg-green-100 utilities.

  26. Use w-4 to set an element to a fixed width(1rem).

  27. Use h-4 to set an element to a fixed height(1rem).

  28. Control the text color of an element to red-600 using the text-red-600 utilities.

  29. Control the background color of an element to red-100 using the bg-red-100 utilities.

  30. Use fixed to position an element relative to the browser window.

  31. Use the bottom-5 utilities to set the bottom position of a positioned element to 1.25rem.

  32. Use w-full to set an element to a 100% based width.

  33. Control the text color of an element to center using the text-center utilities.

  34. 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.