Published on

Learn How To Make A Google Styled Account Menu With Tailwind CSS Like an Expert

Google Styled Account Menu

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 Google Styled Account Menu ui component

Google accounts menu bar built using pure tailwindcss.

Why use Tailwind CSS to build a Google Styled Account Menu ui component?

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

The preview of Google Styled Account Menu ui component

Free download of the Google Styled Account Menu's source code

The source code of Google Styled Account Menu ui component

<div>

  <div class="bg-white sm:max-w-full max-w-md rounded overflow-hidden shadow-lg">
    <div class="text-center p-6  border-b">
      <img class="h-24 w-24 rounded-full mx-auto" src="https://randomuser.me/api/portraits/men/24.jpg" alt="Randy Robertson" />
      <p class="pt-2 text-lg font-semibold">
        Randy Robertson
      </p>
      <p class="text-sm text-gray-600">
        [email protected]
      </p>
      <div class="mt-5">
        <a href="#" class="border rounded-full py-2 px-4 text-xs font-semibold text-gray-700">Manage your Google Account</a>
      </div>
    </div>
    <div class="border-b">
      <!-- First list item -->
      <a href="#" class="px-6 py-3 hover:bg-gray-200 flex"> 
        <div class="w-8 h-8 bg-blue-700 rounded-full text-center align-middle text-white text-lg content-center">D</div>
        <div class="pl-3">
          <p class="text-sm font-semibold">
            Johnny Depp
          </p>
          <p class="text-xs text-gray-600">
            [email protected]
          </p>
        </div>
      </a>
      <!-- Second list item -->
      <a href="#" class="px-6 py-3 hover:bg-gray-200 flex">
        <div class="w-8 h-8 rounded-full text-center align-middle text-lg">
          <img class="w-6 h-6 rounded-full mx-auto" src="https://img.icons8.com/windows/50/000000/add-user-male.png">
        </div>
        <div class="pl-3">
          <p class="text-sm font-semibold text-gray-700">
            Add another account
          </p>
        </div>
      </a>
    </div>
    <div class="border-b">
      <!-- First list item -->
      <div class="px-6 py-4 text-center">
        <a href="#" class="border rounded py-2 px-4 text-xs font-semibold text-gray-70">
          Sign out of all accounts
        </a>
      </div>
    </div>
    
    <div class="px-6 py-4">
      <span class="inline-block rounded-full px-3 py-1 text-xs font-semibold text-gray-600 mr-2">Privacy Policy</span>
      <span class="inline-block rounded-full px-3 py-1 text-xs font-semibold text-gray-600 mr-2">Terms of Service</span>
    </div>
  </div>
</div>

How to build a Google Styled Account Menu with Tailwind CSS?

Install tailwind css of verion 1.0.4

Use the link html tag to import the stylesheet of Tailwind CSS of the version 1.0.4

<link href=https://unpkg.com/[email protected]/dist/tailwind.min.css rel="stylesheet">

All the unility class needed to build a Google Styled Account Menu component

  • bg-white
  • sm:max-w-full
  • max-w-md
  • overflow-hidden
  • text-center
  • p-6
  • border-b
  • h-24
  • w-24
  • mx-auto
  • pt-2
  • text-lg
  • text-sm
  • text-gray-600
  • mt-5
  • py-2
  • px-4
  • text-xs
  • text-gray-700
  • px-6
  • py-3
  • hover:bg-gray-200
  • flex
  • w-8
  • h-8
  • bg-blue-700
  • text-white
  • pl-3
  • w-6
  • h-6
  • py-4
  • text-gray-70
  • inline-block
  • px-3
  • py-1
  • mr-2

36 steps to build a Google Styled Account Menu component with Tailwind CSS

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

  2. Set the maximum width/height of an element using the sm:max-w-full utilities at only small screen sizes.

  3. Set the maximum width/height of an element using the max-w-md utilities.

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

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

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

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

  8. Use h-24 to set an element to a fixed height(6rem).

  9. Use w-24 to set an element to a fixed width(6rem).

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

  11. Control the padding on top side of an element to 0.5rem using the pt-2 utilities.

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

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

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

  15. Control the margin on top side of an element to 1.25rem using the mt-5 utilities.

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

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

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

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

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

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

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

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

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

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

  26. Control the background color of an element to blue-700 using the bg-blue-700 utilities.

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

  28. Adjust the left padding of the element to 0.75rem using the pl-3 utilities class

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

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

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

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

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

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

  35. Control the vertical padding of an element to 0.25rem using the py-1 utilities.

  36. Control the margin on right side of an element to 0.5rem using the mr-2 utilities.

Conclusion

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