Published on

6 Easy Ways To Build A COREUI-Dashboard With Tailwind CSS

Tags
COREUI-Dashboard

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 COREUI-Dashboard ui component

Admin dashboard - only for desktop

Why use Tailwind CSS to build a COREUI-Dashboard ui component?

  • It can make the building process of COREUI-Dashboard ui component faster and more easily.
  • Enables building complex responsive layouts and components freely.
  • Minimum lines of CSS code in COREUI-Dashboard component file.

The preview of COREUI-Dashboard ui component

Free download of the COREUI-Dashboard's source code

The source code of COREUI-Dashboard ui component

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Safal Admin Panel</title>
    <link href="https://unpkg.com/[email protected]^2/dist/tailwind.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"
        integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w=="
        crossorigin="anonymous" />
    <script type="module" src="https://cdn.jsdelivr.net/gh/alpinejs/[email protected]/dist/alpine.min.js"></script>
    <script nomodule src="https://cdn.jsdelivr.net/gh/alpinejs/[email protected]/dist/alpine-ie11.min.js" defer></script>
</head>

<body>
    <div class="flex" style="font-family: Arial;" x-data="{ open: true }">
        <div class="sidebar h-screen" style="width: 260px;" x-show="open">
            <div>
                <div class="text-purple-200 bg-purple-700 h-14 mx-auto block px-4 py-5">
                    WELCOME, ADMIN
                </div>
                <div class="h-screen bg-purple-700">
                    <div class="" style="font-size: 14px;">
                        <a href=""
                            class="h-12 px-4 py-3 text-purple-800 tracking-wider block bg-white font-medium border-b-2 border-purple-800 hover:text-purple-800 hover:bg-white">Dashboard</a>
                        <a href=""
                            class="h-12 px-4 py-3 text-white tracking-wider block bg-purple-600 font-thin border-b-2 border-purple-800 hover:text-purple-800 hover:bg-white">Products</a>
                        <a href=""
                            class="h-12 px-4 py-3 text-white tracking-wider block bg-purple-600 font-thin border-b-2 border-purple-800 hover:text-purple-800 hover:bg-white">Sales</a>
                        <a href=""
                            class="h-12 px-4 py-3 text-white tracking-wider block bg-purple-600 font-thin border-b-2 border-purple-800 hover:text-purple-800 hover:bg-white">Orders</a>
                    </div>
                </div>
            </div>
        </div>
        <div class="w-full z-10">
            <div
                class="sticky top-0 bg-purple-600 header bg-white h-14 px-10 py-4 border-b-4 border-purple-900 flex items-center justify-between">
                <div class="flex items-center space-x-12 text-sm">
                    <i class="hover:text-purple text-xl fas fa-bars font-thin cursor-pointer text-white"
                        @click="open = !open"></i>
                    <a href=""
                        class="hover:text-purple-400 text-white  tracking-wider font-thin"><span>Dashboard</span></a>
                    <a href="" class="hover:text-purple-400 text-white  tracking-wider font-thin">User</a>
                    <a href="" class="hover:text-purple-400 text-white  tracking-wider font-thin">Settings</a>
                </div>
                <div class="flex items-center space-x-8 text-gray-400 text-base px-4 py-2">
                    <span class="relative inline-block cursor-pointer">
                        <i class="fas fa-bell font-thin"></i>
                        <span
                            class="absolute top-0 right-0 inline-flex items-center justify-center px-1  py-0.5 text-xs font-thin leading-none text-red-100 transform translate-x-1/2 -translate-y-1/2 bg-red-600 rounded-full">99</span>
                    </span>
                    <span class="relative inline-block cursor-pointer">
                        <i class="fas fa-list font-thin"></i>
                        <span
                            class="absolute top-0 right-0 inline-flex items-center justify-center px-1 py-0.5 text-xs font-thin leading-none text-red-100 transform translate-x-1/2 -translate-y-1/2 bg-purple-600 rounded-full">99</span>
                    </span>
                    <span class="relative inline-block cursor-pointer">
                        <i class="fas fa-envelope font-thin"></i>
                        <span
                            class="absolute top-0 right-0 inline-flex items-center justify-center px-1 py-0.5 text-xs font-thin leading-none text-red-100 transform translate-x-1/2 -translate-y-1/2 bg-yellow-600 rounded-full">9</span>
                    </span>
                    <i class="fas fa-user-circle fa-lg font-thin cursor-pointer"></i>
                    <i class="fas fa-cog fa-2x font-thin text-white cursor-pointer animate animate-spin hover:text-green-500"
                        style="animation-duration: 7000ms;"></i>
                </div>
            </div>
            <div
                class="sticky top-14 header bg-white h-12 px-10 py-4 border-b-2 border-gray-200 flex items-center justify-between">
                <div class="flex items-center space-x-2 text-gray-400 text-base">
                    <span class="text-black tracking-wider font-thin text-sm">Home</span>
                    <span>/</span>
                    <span class="tracking-wide text-sm">
                        <span class="hover:underline cursor-pointer"
                            style="color: #20a8d8; font-weight: 100;">Admin</span>
                    </span>
                    <span>/</span>
                    <span class="text-black tracking-wider font-thin text-sm text-opacity-50">Dashboard</span>
                </div>
                <div class="flex items-center space-x-6 text-gray-400 text-base text-black">
                    <i class="fas fa-comment-alt mr-1 text-purple-500"></i>
                    <a href="" class="mr-3 text-black">
                        <i class="fas fa-chart-line text-purple-500"></i>
                        <span
                            class="hover:text-purple-400 text-black text-opacity-50 tracking-wider font-thin">Dashboard</span>
                    </a>
                    <a href="" class="text-black">
                        <i class="fas fa-cog text-purple-500"></i>
                        <span
                            class="hover:text-purple-400 text-black text-opacity-50 tracking-wider font-thin">Setting</span>
                    </a>
                </div>
            </div>
            <div class="body">
                <div class="p-8" style="background-color: #E4E5E6;">
                    <div class="main bg-white border-2 border-gray-300 rounded">
                        <div class="rounded-t border-b-2 border-gray-300" style="background-color: #F0F3F5;">
                            <h1 class="p-4">Headings</h1>
                        </div>
                        <div class="p-4">
                            <p class="mb-4">Documentation and examples for Bootstrap typography, including global
                                settings, headings,
                                body text, lists, and more.</p>
                            <hr>
                            Heading Example
                            <h1></h1>

                            h1. Bootstrap heading
                            <h2></h2>

                            h2. Bootstrap heading
                            <h3></h3>

                            h3. Bootstrap heading
                            <h4></h4>

                            h4. Bootstrap heading
                            <h5></h5>

                            h5. Bootstrap heading
                            <h6></h6>

                            h6. Bootstrap heading
                        </div>
                    </div>
                    <div class="main bg-white border-2 border-gray-300 rounded">
                        <div class="rounded-t border-b-2 border-gray-300" style="background-color: #F0F3F5;">
                            <h1 class="p-4">Headings</h1>
                        </div>
                        <div class="p-4">
                            <p class="mb-4">Documentation and examples for Bootstrap typography, including global
                                settings, headings,
                                body text, lists, and more.</p>
                            <hr>
                            Heading Example
                            <h1></h1>

                            h1. Bootstrap heading
                            <h2></h2>

                            h2. Bootstrap heading
                            <h3></h3>

                            h3. Bootstrap heading
                            <h4></h4>

                            h4. Bootstrap heading
                            <h5></h5>

                            h5. Bootstrap heading
                            <h6></h6>

                            h6. Bootstrap heading
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>

</html>

How to build a COREUI-Dashboard 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 build a COREUI-Dashboard component

  • flex
  • h-screen
  • text-purple-200
  • bg-purple-700
  • h-14
  • mx-auto
  • block
  • px-4
  • py-5
  • h-12
  • py-3
  • text-purple-800
  • bg-white
  • border-b-2
  • border-purple-800
  • hover:text-purple-800
  • hover:bg-white
  • text-white
  • bg-purple-600
  • w-full
  • z-10
  • sticky
  • top-0
  • px-10
  • py-4
  • border-b-4
  • border-purple-900
  • text-sm
  • hover:text-purple
  • text-xl
  • hover:text-purple-400
  • text-gray-400
  • text-base
  • py-2
  • relative
  • inline-block
  • absolute
  • right-0
  • inline-flex
  • px-1
  • py-0.5
  • text-xs
  • text-red-100
  • bg-red-600
  • bg-yellow-600
  • hover:text-green-500
  • top-14
  • border-gray-200
  • text-black
  • text-opacity-50
  • mr-1
  • text-purple-500
  • mr-3
  • p-8
  • border-2
  • border-gray-300
  • p-4
  • mb-4

58 steps to build a COREUI-Dashboard component with Tailwind CSS

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

  2. Use h-screen to make an element span the entire height of the viewport.

  3. Control the text color of an element to purple-200 using the text-purple-200 utilities.

  4. Control the background color of an element to purple-700 using the bg-purple-700 utilities.

  5. Use h-14 to set an element to a fixed height(3.5rem).

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

  7. Use inline utilities to put the element on its own line and fill its parent.

  8. Control the horizontal padding of an element to 1rem using the px-4 utilities.

  9. Control the vertical padding of an element to 1.25rem using the py-5 utilities.

  10. Use h-12 to set an element to a fixed height(3rem).

  11. Control the vertical padding of an element to 0.75rem using the py-3 utilities.

  12. Control the text color of an element to purple-800 using the text-purple-800 utilities.

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

  14. Control the border color of an element to b-2 using the border-b-2 utilities.

  15. Control the border color of an element to purple-800 using the border-purple-800 utilities.

  16. Control the text color of an element to purple-800 on hover using the hover:text-purple-800 utilities.

  17. Control the background color of an element to white using the hover:bg-white utilities on hover.

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

  19. Control the background color of an element to purple-600 using the bg-purple-600 utilities.

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

  21. Control the stack order (or three-dimensional positioning) of an element to 10 in Tailwind, regardless of order it has been displayed, using the z-10 utilities.

  22. Use sticky to position an element as relative until it crosses a specified threshold, then treat it as fixed until its parent is off screen.

  23. Use the top-0 utilities to set the top position of a positioned element to 0rem.

  24. Control the horizontal padding of an element to 2.5rem using the px-10 utilities.

  25. Control the vertical padding of an element to 1rem using the py-4 utilities.

  26. Control the border color of an element to b-4 using the border-b-4 utilities.

  27. Control the border color of an element to purple-900 using the border-purple-900 utilities.

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

  29. Control the text color of an element to purple on hover using the hover:text-purple utilities.

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

  31. Control the text color of an element to purple-400 on hover using the hover:text-purple-400 utilities.

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

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

  34. Control the vertical padding of an element to 0.5rem using the py-2 utilities.

  35. Use relative to position an element according to the normal flow of the document.

  36. Use inline-block utilities to wrap the element to prevent the text inside from extending beyond its parent.

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

  38. Use the right-0 utilities to set the right position of a positioned element to 0rem.

  39. Use inline-flex to create an inline flex container that flows with text.

  40. Control the horizontal padding of an element to 0.25rem using the px-1 utilities.

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

  42. Control the text color of an element to xs using the text-xs utilities.

  43. Control the text color of an element to red-100 using the text-red-100 utilities.

  44. Control the background color of an element to red-600 using the bg-red-600 utilities.

  45. Control the background color of an element to yellow-600 using the bg-yellow-600 utilities.

  46. Control the text color of an element to green-500 on hover using the hover:text-green-500 utilities.

  47. Use the top-14 utilities to set the top position of a positioned element to 3.5rem.

  48. Control the border color of an element to gray-200 using the border-gray-200 utilities.

  49. Control the text color of an element to black using the text-black utilities.

  50. Control the text color of an element to opacity-50 using the text-opacity-50 utilities.

  51. Control the margin on right side of an element to 0.25rem using the mr-1 utilities.

  52. Control the text color of an element to purple-500 using the text-purple-500 utilities.

  53. Control the margin on right side of an element to 0.75rem using the mr-3 utilities.

  54. Control the padding on all sides of an element to 2rem using the p-8 utilities.

  55. Control the border color of an element to 0.5rem using the border-2 utilities.

  56. Control the border color of an element to gray-300 using the border-gray-300 utilities.

  57. Control the padding on all sides of an element to 1rem using the p-4 utilities.

  58. Control the margin on bottom side of an element to 1rem using the mb-4 utilities.

Conclusion

The above is a step-by-step tutorial on how to use Tailwind CSS to build a COREUI-Dashboard components, learn and follow along to implement your own components.