Published on

Advanced Guide: Create A Menu Profile Sidebar With Tailwind CSS

Menu profile sidebar

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 Menu profile sidebar ui component

Menu profile sidebar

Why use Tailwind CSS to build a Menu profile sidebar ui component?

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

The preview of Menu profile sidebar ui component

Free download of the Menu profile sidebar's source code

The source code of Menu profile sidebar ui component

<div
                                            class="h-full flex flex-col bg-gray-100 dark:bg-gray-700 shadow-xl overflow-y-scroll">
                                            <div class="ml-3 h-7 flex justify-end items-center">
                                                <button type="button"
                                                    class="bg-gray-100 dark:bg-gray-700 m-1 p-3 justify-end rounded-md text-gray-400 hover:text-gray-500 focus:ring-2 focus:ring-indigo-500">
                                                    <span class="sr-only">Close panel</span>
                                                    <!-- Heroicon name: outline/x -->
                                                    <svg class="h-6 w-6" xmlns="http://www.w3.org/2000/svg"
                                                        fill="none" viewBox="0 0 24 24" stroke="currentColor"
                                                        aria-hidden="true">
                                                        <path stroke-linecap="round" stroke-linejoin="round"
                                                            stroke-width="2" d="M6 18L18 6M6 6l12 12" />
                                                    </svg>
                                                </button>
                                            </div>
                                            <div class="bg-green-300 shadow-lg pb-3 rounded-b-3xl">
                                                <div
                                                    class="flex  rounded-b-3xl bg-gray-100 dark:bg-gray-700 space-y-5 flex-col items-center py-7">
                                                    <img class="h-28 w-28 rounded-full"
                                                        src="https://api.lorem.space/image/face?w=120&h=120&hash=bart89fe"
                                                        alt="User">
                                                    <a href="#"> <span
                                                            class="text-h1">Michele</span></a>
                                                </div>
                                                <div
                                                    class="grid px-7 py-2  items-center justify-around grid-cols-3 gap-4 divide-x divide-solid ">
                                                    <div class="col-span-1 flex flex-col items-center ">
                                                        <span class="text-2xl font-bold dark:text-gray-500">4</span>
                                                        <span class="text-lg font-medium 0">Ranking</span>
                                                    </div>
                                                    <div class="col-span-1 px-3 flex flex-col items-center ">
                                                        <span class="text-2xl font-bold dark:text-gray-500">
                                                           Free</span>
                                                        <span class="text-lg font-medium">Plan</span>
                                                    </div>
                                                    <div class="col-span-1 px-3 flex flex-col items-center ">
                                                        <span class="text-2xl font-bold dark:text-gray-500">
                                                            546</span>
                                                        <span class="text-lg font-medium">Puntos</span>
                                                    </div>
                                                </div>

                                            </div>

                                            <div
                                                class="grid rounded-2xl divide-y divide-dashed hover:divide-solid  justify-evenly bg-gray-50 dark:bg-gray-300 m-3 mt-10 grid-cols-3">
                                                <div class="col-span-1  p-3">
                                                    <div class="flex flex-col items-center ">
                                                        <a href=""> <button
                                                                class="tr-300">
                                                                <svg xmlns="http://www.w3.org/2000/svg"
                                                                    class="h-14 w-14 text-gray-500" fill="none"
                                                                    viewBox="0 0 24 24" stroke="currentColor"
                                                                    stroke-width="2">
                                                                    <path stroke-linecap="round" stroke-linejoin="round"
                                                                        d="M5.121 17.804A13.937 13.937 0 0112 16c2.5 0 4.847.655 6.879 1.804M15 10a3 3 0 11-6 0 3 3 0 016 0zm6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
                                                                </svg>
                                                                <span class="text-lg font-medium">Mi Perfil</span>
                                                            </button></a>
                                                    </div>
                                                </div>
                                                <div class="col-span-1  p-3">
                                                    <div class="flex flex-col items-center ">
                                                        <a href=""> <button
                                                                class="tr-300">
                                                                <svg xmlns="http://www.w3.org/2000/svg"
                                                                    class="h-14 w-14 text-gray-500" fill="none"
                                                                    viewBox="0 0 24 24" stroke="currentColor"
                                                                    stroke-width="2">
                                                                    <path stroke-linecap="round" stroke-linejoin="round"
                                                                        d="M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z" />
                                                                </svg>
                                                                <span class="text-lg font-medium">Mis dinero</span>
                                                            </button></a>
                                                    </div>
                                                </div>
                                                <div class="col-span-1  p-3">
                                                    <div class="flex flex-col items-center ">
                                                        <a href=""> <button
                                                                class="tr-300">
                                                                <svg xmlns="http://www.w3.org/2000/svg"
                                                                    class="h-14 w-14 text-gray-500" fill="none"
                                                                    viewBox="0 0 24 24" stroke="currentColor"
                                                                    stroke-width="2">
                                                                    <path stroke-linecap="round" stroke-linejoin="round"
                                                                        d="M11 5.882V19.24a1.76 1.76 0 01-3.417.592l-2.147-6.15M18 13a3 3 0 100-6M5.436 13.683A4.001 4.001 0 017 6h1.832c4.1 0 7.625-1.234 9.168-3v14c-1.543-1.766-5.067-3-9.168-3H7a3.988 3.988 0 01-1.564-.317z" />
                                                                </svg>
                                                                <span class="text-lg font-medium">Mis referidos</span>
                                                            </button></a>
                                                    </div>
                                                </div>
                                                <div class="col-span-1  p-3">
                                                    <div class="flex flex-col items-center ">
                                                        <a href="">
                                                            <button class="tr-300">
                                                                <svg xmlns="http://www.w3.org/2000/svg"
                                                                    class="h-14 w-14 text-gray-500" fill="none"
                                                                    viewBox="0 0 24 24" stroke="currentColor"
                                                                    stroke-width="2">
                                                                    <path stroke-linecap="round" stroke-linejoin="round"
                                                                        d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
                                                                </svg>
                                                                <span class="text-lg font-medium">Mis facturas</span>
                                                            </button></a>
                                                    </div>
                                                </div>
                                                <div class="col-span-1  p-3">
                                                    <div class="flex flex-col items-center ">
                                                        <a href=""> <button class="tr-300">
                                                                <svg xmlns="http://www.w3.org/2000/svg"
                                                                    class="h-14 w-14 text-gray-500" fill="none"
                                                                    viewBox="0 0 24 24" stroke="currentColor"
                                                                    stroke-width="2">
                                                                    <path stroke-linecap="round" stroke-linejoin="round"
                                                                        d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />
                                                                </svg>
                                                                <span class="text-lg font-medium">Ayuda</span>
                                                            </button></a>
                                                    </div>
                                                </div>
                                                <div class="col-span-1 bg-red-50 p-3">
                                                    <div class="flex  flex-col items-center ">
                                                        <a href=""> <button class="tr-300">
                                                                <svg xmlns="http://www.w3.org/2000/svg"
                                                                    class="h-14 w-14 text-gray-500" fill="none"
                                                                    viewBox="0 0 24 24" stroke="currentColor"
                                                                    stroke-width="2">
                                                                    <path stroke-linecap="round" stroke-linejoin="round"
                                                                        d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1" />
                                                                </svg>
                                                                <span class="text-lg font-medium">Salir</span>
                                                            </button></a>
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="flex mx-auto mt-3 w-100 ">
                                                <a href=""> <button
                                                        class="p-2 shadow-lg rounded-2xl tr-300 w-100 font-medium  bg-green-500 rounded-md hover:bg-green-600 text-gray-50">Mejorar
                                                        membresía</button></a>
                                            </div>
                                        </div>

How to build a Menu profile sidebar with Tailwind CSS?

Install tailwind css of verion 3.0.18

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

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

All the unility class needed to build a Menu profile sidebar component

  • h-full
  • flex
  • flex-col
  • bg-gray-100
  • dark:bg-gray-700
  • overflow-y-scroll
  • ml-3
  • h-7
  • m-1
  • p-3
  • text-gray-400
  • hover:text-gray-500
  • h-6
  • w-6
  • bg-green-300
  • pb-3
  • py-7
  • h-28
  • w-28
  • text-h1
  • grid
  • px-7
  • py-2
  • grid-cols-3
  • gap-4
  • text-2xl
  • dark:text-gray-500
  • text-lg
  • px-3
  • bg-gray-50
  • dark:bg-gray-300
  • m-3
  • mt-10
  • h-14
  • w-14
  • text-gray-500
  • bg-red-50
  • mx-auto
  • mt-3
  • w-100
  • p-2
  • bg-green-500
  • hover:bg-green-600
  • text-gray-50

44 steps to build a Menu profile sidebar component with Tailwind CSS

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

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

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

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

  5. Control the background color of an element to gray-700 using the dark:bg-gray-700 utilities in dark theme.

  6. Use overflow-y-scroll to allow vertical scrolling and always show scrollbars unless always-visible scrollbars are disabled by the operating system.

  7. Control the margin on left side of an element to 0.75rem using the ml-3 utilities.

  8. Use h-7 to set an element to a fixed height(1.75rem).

  9. Control the margin on all sides of an element to 0.25rem using the m-1 utilities.

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

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

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

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

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

  15. Control the background color of an element to green-300 using the bg-green-300 utilities.

  16. Control the padding on bottom side of an element to 0.75rem using the pb-3 utilities.

  17. Control the vertical padding of an element to 1.75rem using the py-7 utilities.

  18. Use h-28 to set an element to a fixed height(7rem).

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

  20. Control the text color of an element to h1 using the text-h1 utilities.

  21. Use grid to create a grid container.

  22. Control the horizontal padding of an element to 1.75rem using the px-7 utilities.

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

  24. Use grid to create a grid container.

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

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

  27. Control the text color of an element to gray-500 in dark theme using the dark:text-gray-500 utilities.

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

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

  30. Control the background color of an element to gray-50 using the bg-gray-50 utilities.

  31. Control the background color of an element to gray-300 using the dark:bg-gray-300 utilities in dark theme.

  32. Control the margin on all sides of an element to 0.75rem using the m-3 utilities.

  33. Control the margin on top side of an element to 2.5rem using the mt-10 utilities.

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

  35. Use w-14 to set an element to a fixed width(3.5rem).

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

  37. Control the background color of an element to red-50 using the bg-red-50 utilities.

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

  39. Control the margin on top side of an element to 0.75rem using the mt-3 utilities.

  40. Use w-100 to set an element to a fixed width(25rem).

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

  42. Control the background color of an element to green-500 using the bg-green-500 utilities.

  43. Control the background color of an element to green-600 using the hover:bg-green-600 utilities on hover.

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

Conclusion

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