Published on

Learn How To Create A Expense Tracker Using Tailwindcss With Tailwind CSS from the Pros

Tags
Expense Tracker using Tailwindcss

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 Expense Tracker using Tailwindcss ui component

Semoga bermanfaat untuk semua

Why use Tailwind CSS to make a Expense Tracker using Tailwindcss ui component?

  • It can make the building process of Expense Tracker using Tailwindcss ui component faster and more easily.
  • Enables building complex responsive layouts and components freely.
  • Minimum lines of CSS code in Expense Tracker using Tailwindcss component file.

The preview of Expense Tracker using Tailwindcss ui component

Free download of the Expense Tracker using Tailwindcss's source code

The source code of Expense Tracker using Tailwindcss ui component

<div class="bg-white">
    <div class="grid grid-cols-12 gap-0 ">
        <div class="bg-fixed relative col-span-12 sm:col-span-12 md:col-span-7 lg:col-span-8 xxl:col-span-8 hidden md:block" 
        style="
            background-image:url('https://i.pinimg.com/originals/74/79/b0/7479b0e55f61567d40b0709a4d1b95d9.gif');
            background-size: cover;
            ">
            <!-- <div className="h-screen bg-gray-700 sticky inset-0 ">
                <video 
                    src={Video} 
                    autoPlay
                    muted 
                    loop 
                    class="object-cover w-full h-full"
                >
                </video>  
            </div> -->
            <div class="absolute inset-0 z-20 flex items-center justify-center h-full bg-gray-900 bg-opacity-50">
                <div class="flex justify-center h-full items-center fixed top-0">
                    <p class="text-white text-5xl lg:text-7xl">
                        <span class="border-2 p-4 rounded-md" id="time"></span>
                    </p>
                </div>
            </div>
        </div>
        <div class="col-span-12 sm:col-span-12 md:col-span-5 lg:col-span-4 xxl:col-span-4">
            <div>
            <div class="border-b">
                    <div class="my-4 px-6">
                        <h2 class="font-semibold text-2xl">Expense Tracker</h2>
                    </div>
                </div>
                <div class="px-8 py-2">
                    <h4 class="text-lg text-gray-500 font-thin">Your Balance</h4>
                    <h4 class="text-2xl font-semibold">RM 430.00</h4>
                </div>
                <div class="flex space-x-0 flex-col lg:flex-row lg:space-x-2 my-2 px-6">
                    <div class="bg-green-600 p-4 border-2 rounded-md shadow-lg  w-full text-white text-center">
                        <h1 class="text-xl font-light">INCOME</h1>
                        <h1 class="text-2xl text-green-100 font-semibold">RM 600.00</h1>
                    </div>
                    <div class="bg-red-600 p-4 border-2 rounded-md shadow-lg  w-full text-white text-center">
                        <h1 class="text-xl font-light">EXPENSE</h1>
                        <h1 class="text-2xl text-red-100 font-semibold">RM 170.00</h1>
                    </div>
                </div>
                <div class="px-8 my-6">
                    <div class="my-4 border-b w-full">
                        <h2 class="font-semibold text-lg">History</h2>
                    </div>
                    <div class="ml-6 relative bg-white p-4 border-r-8 shadow-md my-4 flex justify-between border-green-500">
                        <div class="absolute -left-6">
                            <div class="cursor-pointer bg-red-600 p-2 w-6 flex items-center text-xs text-white justify-center">
                                x
                            </div>
                        </div>
                        <div>
                            <p>My wallet</p>
                        </div>
                        <div>
                            <p>RM +400</p>
                        </div>
                    </div>
                    <div class="ml-6 relative bg-white p-4 border-r-8 shadow-md my-4 flex justify-between border-green-500">
                        <div class="absolute -left-6">
                            <div class="cursor-pointer bg-red-600 p-2 w-6 flex items-center text-xs text-white justify-center">
                                x
                            </div>
                        </div>
                        <div>
                            <p>Deck</p>
                        </div>
                        <div>
                            <p>RM +200</p>
                        </div>
                    </div>
                    <div class="ml-6 relative bg-white p-4 border-r-8 shadow-md my-4 flex justify-between border-red-500">
                        <div class="absolute -left-6">
                            <div class="cursor-pointer bg-red-600 p-2 w-6 flex items-center text-xs text-white justify-center">
                                x
                            </div>
                        </div>
                        <div>
                            <p>Wheel</p>
                        </div>
                        <div>
                            <p>RM -170</p>
                        </div>
                    </div>
                </div>
                <div class="px-8 my-6">
                    <div class="my-4 border-b w-full">
                        <h2 class="font-semibold text-lg">Add new transaction</h2>
                    </div>
                    <div class="bg-white p-4 border-2 rounded-md">
                        <form  class="mt-4">
                            <div class="my-5 text-sm">
                                <label htmlFor="text" class="block text-black">Text</label>
                                <input type="text" autoFocus 
                                class="rounded-sm px-4 py-3 mt-1 focus:outline-none bg-gray-100 w-full" 
                                placeholder="Enter Text" />
                            </div>
                            <div class="my-5 text-sm">
                                <label htmlFor="amount" class="block text-black">
                                    Amount 
                                    <small class="text-gray-600"> (
                                        <span class="text-red-400"> negative-expense</span> ,
                                        <span class="text-green-400"> positive-income</span>
                                        )
                                    </small>
                                </label>
                                <input type="number" autoFocus
                                class="rounded-sm px-4 py-3 mt-1 focus:outline-none bg-gray-100 w-full" 
                                placeholder="Enter Amount" />
                            </div>
                            <div class="my-5">
                                <button class="rounded-sm block text-center text-white bg-gray-800 p-3 duration-300  hover:bg-black w-full">
                                    Add Transaction
                                </button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    const getCurrentTimeDate = () => {
        let currentTimeDate = new Date();
        var hours   =  currentTimeDate.getHours();
        var minutes =  currentTimeDate.getMinutes();
        minutes = minutes < 10 ? '0'+minutes : minutes;
         var AMPM = hours >= 12 ? 'PM' : 'AM';
        if(hours === 12){
            hours=12;
        }else{
            hours = hours%12;
        }
        var currentTime = `${hours}:${minutes}${AMPM}`;
        document.getElementById("time").innerHTML = currentTime;
        setTimeout(getCurrentTimeDate, 500);
    }
    getCurrentTimeDate();
</script>

How to make a Expense Tracker using Tailwindcss 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 Expense Tracker using Tailwindcss component

  • bg-white
  • grid
  • grid-cols-12
  • gap-0
  • bg-fixed
  • relative
  • hidden
  • md:block
  • w-full
  • h-full
  • absolute
  • z-20
  • flex
  • bg-gray-900
  • bg-opacity-50
  • fixed
  • top-0
  • text-white
  • text-5xl
  • lg:text-7xl
  • border-2
  • p-4
  • border-b
  • my-4
  • px-6
  • text-2xl
  • px-8
  • py-2
  • text-lg
  • text-gray-500
  • flex-col
  • lg:flex-row
  • my-2
  • bg-green-600
  • text-center
  • text-xl
  • text-green-100
  • bg-red-600
  • text-red-100
  • my-6
  • ml-6
  • border-r-8
  • border-green-500
  • -left-6
  • p-2
  • w-6
  • text-xs
  • border-red-500
  • mt-4
  • my-5
  • text-sm
  • block
  • text-black
  • px-4
  • py-3
  • mt-1
  • bg-gray-100
  • text-gray-600
  • text-red-400
  • text-green-400
  • bg-gray-800
  • p-3
  • hover:bg-black

63 steps to make a Expense Tracker using Tailwindcss component with Tailwind CSS

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

  2. Use grid to create a grid container.

  3. Use grid to create a grid container.

  4. To specify the width between columns, you can use the gap-0 utilities.

  5. Control the background color of an element to fixed using the bg-fixed utilities.

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

  7. Use hidden to set an element to display: none and remove it from the page layout.

  8. Use inline utilities to put the element on its own line and fill its parent at only medium screen sizes.

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

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

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

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

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

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

  15. Control the background color of an element to opacity-50 using the bg-opacity-50 utilities.

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

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

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

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

  20. Control the text color of an element to 7xl at only large screen sizes using the lg:text-7xl utilities.

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

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

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

  24. Control the vertical margin of an element to 1rem using the my-4 utilities.

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

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

  27. Control the horizontal padding of an element to 2rem using the px-8 utilities.

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

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

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

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

  32. Use flex to create a block-level flex container at only large screen sizes.

  33. Control the vertical margin of an element to 0.5rem using the my-2 utilities.

  34. Control the background color of an element to green-600 using the bg-green-600 utilities.

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

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

  37. Control the text color of an element to green-100 using the text-green-100 utilities.

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

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

  40. Control the vertical margin of an element to 1.5rem using the my-6 utilities.

  41. Control the margin on left side of an element to 1.5rem using the ml-6 utilities.

  42. Control the border color of an element to r-8 using the border-r-8 utilities.

  43. Control the border color of an element to green-500 using the border-green-500 utilities.

  44. Use the -left-6 utilities to set the left position of a positioned element to -1.5rem.

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

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

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

  48. Control the border color of an element to red-500 using the border-red-500 utilities.

  49. Control the margin on top side of an element to 1rem using the mt-4 utilities.

  50. Control the vertical margin of an element to 1.25rem using the my-5 utilities.

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

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

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

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

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

  56. Control the margin on top side of an element to 0.25rem using the mt-1 utilities.

  57. Control the background color of an element to gray-100 using the bg-gray-100 utilities.

  58. Control the text color of an element to gray-600 using the text-gray-600 utilities.

  59. Control the text color of an element to red-400 using the text-red-400 utilities.

  60. Control the text color of an element to green-400 using the text-green-400 utilities.

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

  62. Control the padding on all sides of an element to 0.75rem using the p-3 utilities.

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

Conclusion

The above is a step-by-step tutorial on how to use Tailwind CSS to make a Expense Tracker using Tailwindcss components, learn and follow along to implement your own components.