Published on

6 Tips To Build A Form Login With Tailwind CSS

Form Login

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 Form Login ui component

Form login

Why use Tailwind CSS to make a Form Login ui component?

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

The preview of Form Login ui component

Free download of the Form Login's source code

The source code of Form Login ui component

<div class="h-screen flex">
  <div class="flex w-1/2 bg-gradient-to-tr from-blue-800 to-purple-700 i justify-around items-center">
    <div>
      <h1 class="text-white font-bold text-4xl font-sans">GoFinance</h1>
      <p class="text-white mt-1">The most popular peer to peer lending at SEA</p>
      <button type="submit" class="block w-28 bg-white text-indigo-800 mt-4 py-2 rounded-2xl font-bold mb-2">Read More</button>
    </div>
  </div>
  <div class="flex w-1/2 justify-center items-center bg-white">
    <form class="bg-white">
      <h1 class="text-gray-800 font-bold text-2xl mb-1">Hello Again!</h1>
      <p class="text-sm font-normal text-gray-600 mb-7">Welcome Back</p>
      <div class="flex items-center border-2 py-2 px-3 rounded-2xl mb-4">
        <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
          <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 12a4 4 0 10-8 0 4 4 0 008 0zm0 0v1.5a2.5 2.5 0 005 0V12a9 9 0 10-9 9m4.5-1.206a8.959 8.959 0 01-4.5 1.207" />
        </svg>
        <input class="pl-2 outline-none border-none" type="text" name="" id="" placeholder="Email Address" />
      </div>
      <div class="flex items-center border-2 py-2 px-3 rounded-2xl">
        <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-gray-400" viewBox="0 0 20 20" fill="currentColor">
          <path fill-rule="evenodd" d="M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z" clip-rule="evenodd" />
        </svg>
        <input class="pl-2 outline-none border-none" type="text" name="" id="" placeholder="Password" />
      </div>
      <button type="submit" class="block w-full bg-indigo-600 mt-4 py-2 rounded-2xl text-white font-semibold mb-2">Login</button>
      <span class="text-sm ml-2 hover:text-blue-500 cursor-pointer">Forgot Password ?</span>
    </form>
  </div>
</div>

How to make a Form Login 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 Form Login component

  • h-screen
  • flex
  • w-1/2
  • bg-gradient-to-tr
  • text-white
  • text-4xl
  • mt-1
  • block
  • w-28
  • bg-white
  • text-indigo-800
  • mt-4
  • py-2
  • mb-2
  • text-gray-800
  • text-2xl
  • mb-1
  • text-sm
  • text-gray-600
  • mb-7
  • border-2
  • px-3
  • mb-4
  • h-5
  • w-5
  • text-gray-400
  • pl-2
  • border-none
  • w-full
  • bg-indigo-600
  • ml-2
  • hover:text-blue-500

32 steps to make a Form Login component with Tailwind CSS

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

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

  3. Use w-1/2 to set an element to a fixed width(1/2).

  4. Control the background color of an element to gradient-to-tr using the bg-gradient-to-tr utilities.

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

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

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

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

  9. Use w-28 to set an element to a fixed width(7rem).

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

  11. Control the text color of an element to indigo-800 using the text-indigo-800 utilities.

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

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

  14. Control the margin on bottom side of an element to 0.5rem using the mb-2 utilities.

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

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

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

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

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

  20. Control the margin on bottom side of an element to 1.75rem using the mb-7 utilities.

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

  22. Control the horizontal padding of an element to 0.75rem using the px-3 utilities.

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

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

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

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

  27. Adjust the left padding of an element to 0.5rem using the pl-2 utilities class

  28. Control the border color of an element to none using the border-none utilities.

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

  30. Control the background color of an element to indigo-600 using the bg-indigo-600 utilities.

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

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

Conclusion

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