Published on

6 Incredibly Easy Ways To Build A Firebase Dashboard Layout With Tailwind CSS Better While Spending Less

Firebase Dashboard Layout

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 Firebase Dashboard Layout ui component

This is a copy of the firebase dashboard, created using tailwind.

Why use Tailwind CSS to build a Firebase Dashboard Layout ui component?

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

The preview of Firebase Dashboard Layout ui component

Free download of the Firebase Dashboard Layout's source code

The source code of Firebase Dashboard Layout ui component

<div class="flex min-h-screen">
  <nav class="w-64 flex-shrink-0">
    <div class="flex-auto bg-gray-900 h-full">
      <div class="flex flex-col overflow-y-auto">
        <ul class="relative m-0 p-0 list-none h-full">
          <li class="text-white text-2xl p-4 w-full flex relative shadow-sm justify-start bg-gray-800 border-b-2 border-gray-700">
            Firebase
          </li>
          <li class="text-white p-4 w-full flex relative shadow-sm justify-start bg-gray-800 border-b-2 border-gray-700">
            <div class="mr-4 flex-shrink-0 my-auto">
              <svg class="fill-current w-5 h-5" focusable="false" viewBox="0 0 24 24" aria-hidden="true"><path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"></path></svg>
            </div>
            <div class="flex-auto my-1">
              <span>Project Overview</span>
            </div>
          </li>
          <li class="p-4 w-full flex relative shadow-sm">
            <div class="flex-auto my-1">
              <span class="text-white font-medium">Develop</span>
            </div>
          </li>

          <div class="text-blue-400 flex relative px-4 hover:bg-gray-700 cursor-pointer">
            <div class="mr-4 my-auto">
              <svg class="fill-current h-5 w-5" focusable="false" viewBox="0 0 24 24" aria-hidden="true"><path d="M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5c-1.66 0-3 1.34-3 3s1.34 3 3 3zm-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5C6.34 5 5 6.34 5 8s1.34 3 3 3zm0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5zm8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5z"></path></svg>
            </div>
            <div class="flex-auto my-1">
              <span>Authentication</span>
            </div>
          </div>

          <div class="text-gray-400 flex relative px-4 hover:bg-gray-700 cursor-pointer">
            <div class="mr-4 my-auto">
              <svg class="fill-current h-5 w-5" focusable="false" viewBox="0 0 24 24" aria-hidden="true"><path d="M19 13H5c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-4c0-1.1-.9-2-2-2zM7 19c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zM19 3H5c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM7 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"></path></svg>
            </div>
            <div class="flex-auto my-1">
              <span>Realtime Database</span>
            </div>
          </div>

          <div class="text-gray-400 flex relative px-4 hover:bg-gray-700 cursor-pointer">
            <div class="mr-4 my-auto">
              <svg class="fill-current h-5 w-5" focusable="false" viewBox="0 0 24 24" aria-hidden="true"><path d="M21 3H3C2 3 1 4 1 5v14c0 1.1.9 2 2 2h18c1 0 2-1 2-2V5c0-1-1-2-2-2zM5 17l3.5-4.5 2.5 3.01L14.5 11l4.5 6H5z"></path></svg>            </div>
            <div class="flex-auto my-1">
              <span>Storage</span>
            </div>
          </div>

          <div class="text-gray-400 flex relative px-4 hover:bg-gray-700 cursor-pointer">
            <div class="mr-4 my-auto">
              <svg class="fill-current h-5 w-5" focusable="false" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"></path></svg>            </div>
            <div class="flex-auto my-1">
              <span>Hosting</span>
            </div>
          </div>

          <div class="text-gray-400 flex relative px-4 hover:bg-gray-700 cursor-pointer">
            <div class="mr-4 my-auto">
              <svg class="fill-current h-5 w-5" focusable="false" viewBox="0 0 24 24" aria-hidden="true"><path d="M7.77 6.76L6.23 5.48.82 12l5.41 6.52 1.54-1.28L3.42 12l4.35-5.24zM7 13h2v-2H7v2zm10-2h-2v2h2v-2zm-6 2h2v-2h-2v2zm6.77-7.52l-1.54 1.28L20.58 12l-4.35 5.24 1.54 1.28L23.18 12l-5.41-6.52z"></path></svg>
            </div>
            <div class="flex-auto my-1">
              <span>Functions</span>
            </div>
          </div>
        </ul>
      </div>
    </div>
  </nav>

  <div class="flex flex-col w-full">
    <header class="text-white bg-blue-400 sticky left-auto top-0 right-0">
      <div class="h-12 px-6 flex relative items-center justify-end">
        <button class="flex mx-4 text-white hover:text-gray-200 focus:outline-none">
         <svg class="h-6 w-6" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path d="M15 17H20L18.5951 15.5951C18.2141 15.2141 18 14.6973 18 14.1585V11C18 8.38757 16.3304 6.16509 14 5.34142V5C14 3.89543 13.1046 3 12 3C10.8954 3 10 3.89543 10 5V5.34142C7.66962 6.16509 6 8.38757 6 11V14.1585C6 14.6973 5.78595 15.2141 5.40493 15.5951L4 17H9M15 17V18C15 19.6569 13.6569 21 12 21C10.3431 21 9 19.6569 9 18V17M15 17H9" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
            </path>
         </svg>
        </button>

        <button class="relative block h-8 w-8 rounded-full overflow-hidden shadow focus:outline-none">
          <img class="h-full w-full object-cover" src="https://www.w3schools.com/howto/img_avatar.png" alt="Avatar">
        </button>
      </div>
    </header>
    
    <div class="text-white bg-blue-400 flex flex-shrink-0 flex-col">
      <div class="flex relative items-center p-4 h-12">
        <span class="text-2xl tracking-wide">Authentication</span>
      </div>
    </div>

    <div class="text-white bg-blue-400 flex w-full">
      <div class="flex overflow-hidden h-12 ml-2">
        <button class="mx-3 border-b-2 border-white">
          <span>Users</span>
        </button>

        <button class="mx-3 hover:border-b-2 border-white">
          <span>Sign-in method</span>
        </button>

        <button class="mx-3 hover:border-b-2 border-white">
          <span>Templates</span>
        </button>

        <button class="mx-3 hover:border-b-2 border-white">
          <span>Usage</span>
        </button>
      </div>
    </div>
  </div>
</div>

How to build a Firebase Dashboard Layout with Tailwind CSS?

Install tailwind css of verion 2.0.2

Use the script html tag to import the script of Tailwind CSS of the version 2.0.2

<script src="https://cdn.tailwindcss.com"></script>

All the unility class needed to build a Firebase Dashboard Layout component

  • flex
  • min-h-screen
  • w-64
  • flex-shrink-0
  • flex-auto
  • bg-gray-900
  • h-full
  • flex-col
  • overflow-y-auto
  • relative
  • m-0
  • p-0
  • text-white
  • text-2xl
  • p-4
  • w-full
  • justify-start
  • bg-gray-800
  • border-b-2
  • border-gray-700
  • mr-4
  • my-auto
  • w-5
  • h-5
  • my-1
  • text-blue-400
  • px-4
  • hover:bg-gray-700
  • text-gray-400
  • bg-blue-400
  • sticky
  • left-auto
  • top-0
  • right-0
  • h-12
  • px-6
  • mx-4
  • hover:text-gray-200
  • h-6
  • w-6
  • block
  • h-8
  • w-8
  • overflow-hidden
  • ml-2
  • mx-3
  • border-white
  • hover:border-b-2

48 steps to build a Firebase Dashboard Layout 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. Use w-64 to set an element to a fixed width(16rem).

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

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

  6. Control the background color of an element to gray-900 using the bg-gray-900 utilities.

  7. Use h-full to set an element’s height to 100% of its parent, as long as the parent has a defined height.

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

  9. Use overflow-y-auto to allow vertical scrolling if needed.

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

  11. Control the margin on all sides of an element to 0rem using the m-0 utilities.

  12. Control the padding on all sides of an element to 0rem using the p-0 utilities.

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

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

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

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

  17. Use justify-start to justify items against the start of the container’s main axis.

  18. Control the background color of an element to gray-800 using the bg-gray-800 utilities.

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

  20. Control the border color of an element to gray-700 using the border-gray-700 utilities.

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

  22. Control the vertical margin of an element to auto using the my-auto utilities.

  23. Use w-5 to set an element to a fixed width(1.25rem).

  24. Use h-5 to set an element to a fixed height(1.25rem).

  25. Control the vertical margin of an element to 0.25rem using the my-1 utilities.

  26. Control the text color of an element to blue-400 using the text-blue-400 utilities.

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

  28. Control the background color of an element to gray-700 using the hover:bg-gray-700 utilities on hover.

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

  30. Control the background color of an element to blue-400 using the bg-blue-400 utilities.

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

  32. Use the left-auto utilities to set the left position of a positioned element to auto.

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

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

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

  36. Control the horizontal padding of an element to 1.5rem using the px-6 utilities.

  37. Control the horizontal margin of an element to 1rem using the mx-4 utilities.

  38. Control the text color of an element to gray-200 on hover using the hover:text-gray-200 utilities.

  39. Use h-6 to set an element to a fixed height(1.5rem).

  40. Use w-6 to set an element to a fixed width(1.5rem).

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

  42. Use h-8 to set an element to a fixed height(2rem).

  43. Use w-8 to set an element to a fixed width(2rem).

  44. Use overflow-hidden to clip any content within an element that overflows the bounds of that element.

  45. Control the margin on left side of an element to 0.5rem using the ml-2 utilities.

  46. Control the horizontal margin of an element to 0.75rem using the mx-3 utilities.

  47. Control the border color of an element to white using the border-white utilities.

  48. Control the border color of an element to b-2 using the hover:border-b-2 utilities on hover.

Conclusion

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