DropDown Components

Tailwind CSS DropDown

# Simple

Code

1<div class="relative">
2  <div
3    class=" z-10 mt-2 w-56 rounded-md border border-gray-100 bg-white shadow-lg"
4    role="menu"
5  >
6    <div class="p-2">
7      <a
8        href="#"
9        class="block rounded-lg px-4 py-2 text-sm text-gray-500 hover:bg-gray-50 hover:text-gray-700"
10        role="menuitem"
11      >
12        View on Storefront
13      </a>
14
15      <a
16        href="#"
17        class="block rounded-lg px-4 py-2 text-sm text-gray-500 hover:bg-gray-50 hover:text-gray-700"
18        role="menuitem"
19      >
20        View Warehouse Info
21      </a>
22
23      <a
24        href="#"
25        class="block rounded-lg px-4 py-2 text-sm text-gray-500 hover:bg-gray-50 hover:text-gray-700"
26        role="menuitem"
27      >
28        Duplicate Product
29      </a>
30
31      <a
32        href="#"
33        class="block rounded-lg px-4 py-2 text-sm text-gray-500 hover:bg-gray-50 hover:text-gray-700"
34        role="menuitem"
35      >
36        Unpublish Product
37      </a>
38
39      <form method="POST" action="#">
40        <button
41          type="submit"
42          class="flex w-full items-center gap-2 rounded-lg px-4 py-2 text-sm text-red-700 hover:bg-red-50"
43          role="menuitem"
44        >
45          <svg
46            xmlns="http://www.w3.org/2000/svg"
47            class="h-4 w-4"
48            fill="none"
49            viewBox="0 0 24 24"
50            stroke="currentColor"
51            stroke-width="2"
52          >
53            <path
54              stroke-linecap="round"
55              stroke-linejoin="round"
56              d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"
57            />
58          </svg>
59
60          Delete Product
61        </button>
62      </form>
63    </div>
64  </div>
65</div>

# Simple with Divide

Code

1<div class="relative">
2  <div
3    class=" z-10 mt-2 w-56 divide-y divide-gray-100 rounded-md border border-gray-100 bg-white shadow-lg"
4    role="menu"
5  >
6    <div class="p-2">
7      <a
8        href="#"
9        class="block rounded-lg px-4 py-2 text-sm text-gray-500 hover:bg-gray-50 hover:text-gray-700"
10        role="menuitem"
11      >
12        View on Storefront
13      </a>
14
15      <a
16        href="#"
17        class="block rounded-lg px-4 py-2 text-sm text-gray-500 hover:bg-gray-50 hover:text-gray-700"
18        role="menuitem"
19      >
20        View Warehouse Info
21      </a>
22
23      <a
24        href="#"
25        class="block rounded-lg px-4 py-2 text-sm text-gray-500 hover:bg-gray-50 hover:text-gray-700"
26        role="menuitem"
27      >
28        Duplicate Product
29      </a>
30
31      <a
32        href="#"
33        class="block rounded-lg px-4 py-2 text-sm text-gray-500 hover:bg-gray-50 hover:text-gray-700"
34        role="menuitem"
35      >
36        Unpublish Product
37      </a>
38    </div>
39
40    <div class="p-2">
41      <form method="POST" action="#">
42        <button
43          type="submit"
44          class="flex w-full items-center gap-2 rounded-lg px-4 py-2 text-sm text-red-700 hover:bg-red-50"
45          role="menuitem"
46        >
47          <svg
48            xmlns="http://www.w3.org/2000/svg"
49            class="h-4 w-4"
50            fill="none"
51            viewBox="0 0 24 24"
52            stroke="currentColor"
53            stroke-width="2"
54          >
55            <path
56              stroke-linecap="round"
57              stroke-linejoin="round"
58              d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"
59            />
60          </svg>
61
62          Delete Product
63        </button>
64      </form>
65    </div>
66  </div>
67</div>

# Simple with Sections

Code

1<div class="relative">
2  <div
3    class=" z-10 mt-2 w-56 divide-y divide-gray-100 rounded-md border border-gray-100 bg-white shadow-lg"
4    role="menu"
5  >
6    <div class="p-2">
7      <strong class="block p-2 text-xs font-medium uppercase text-gray-400"> General </strong>
8
9      <a
10        href="#"
11        class="block rounded-lg px-4 py-2 text-sm text-gray-500 hover:bg-gray-50 hover:text-gray-700"
12        role="menuitem"
13      >
14        View on Storefront
15      </a>
16
17      <a
18        href="#"
19        class="block rounded-lg px-4 py-2 text-sm text-gray-500 hover:bg-gray-50 hover:text-gray-700"
20        role="menuitem"
21      >
22        View Warehouse Info
23      </a>
24
25      <a
26        href="#"
27        class="block rounded-lg px-4 py-2 text-sm text-gray-500 hover:bg-gray-50 hover:text-gray-700"
28        role="menuitem"
29      >
30        Duplicate Product
31      </a>
32
33      <a
34        href="#"
35        class="block rounded-lg px-4 py-2 text-sm text-gray-500 hover:bg-gray-50 hover:text-gray-700"
36        role="menuitem"
37      >
38        Unpublish Product
39      </a>
40    </div>
41
42    <div class="p-2">
43      <strong class="block p-2 text-xs font-medium uppercase text-gray-400"> Danger Zone </strong>
44
45      <form method="POST" action="#">
46        <button
47          type="submit"
48          class="flex w-full items-center gap-2 rounded-lg px-4 py-2 text-sm text-red-700 hover:bg-red-50"
49          role="menuitem"
50        >
51          <svg
52            xmlns="http://www.w3.org/2000/svg"
53            class="h-4 w-4"
54            fill="none"
55            viewBox="0 0 24 24"
56            stroke="currentColor"
57            stroke-width="2"
58          >
59            <path
60              stroke-linecap="round"
61              stroke-linejoin="round"
62              d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"
63            />
64          </svg>
65
66          Delete Product
67        </button>
68      </form>
69    </div>
70  </div>
71</div>

# User Dropdown

avatar Evan You
Evan You

evanyou@gmail.com

Free Plan

12,000 views

Code

1<!-- component -->
2        <div class="flex items-center justify-center">
3            <div
4            class="w-full max-w-sm rounded-lg bg-white p-3 drop-shadow-xl divide-y divide-gray-200"
5          >
6            <div aria-label="header" class="flex space-x-4 items-center p-4">
7              <div aria-label="avatar" class="flex mr-auto items-center space-x-4">
8                <img
9                  src="https://avatars.githubusercontent.com/u/499550?v=4"
10                  alt="avatar Evan You"
11                  class="w-16 h-16 shrink-0 rounded-full"
12                />
13                <div class="space-y-2 flex flex-col flex-1 truncate">
14                  <div class="font-medium relative text-xl leading-tight text-gray-900">
15                    <span class="flex">
16                      <span class="truncate relative pr-8">
17                        Evan You
18                        <span
19                          aria-label="verified"
20                          class="absolute top-1/2 -translate-y-1/2 right-0 inline-block rounded-full"
21                        >
22                          <svg
23                            xmlns="http://www.w3.org/2000/svg"
24                            aria-hidden="true"
25                            class="w-6 h-6 ml-1 text-cyan-400"
26                            width="24"
27                            height="24"
28                            viewBox="0 0 24 24"
29                            stroke-width="2"
30                            stroke="currentColor"
31                            fill="none"
32                            stroke-linecap="round"
33                            stroke-linejoin="round"
34                          >
35                            <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
36                            <path
37                              d="M12.01 2.011a3.2 3.2 0 0 1 2.113 .797l.154 .145l.698 .698a1.2 1.2 0 0 0 .71 .341l.135 .008h1a3.2 3.2 0 0 1 3.195 3.018l.005 .182v1c0 .27 .092 .533 .258 .743l.09 .1l.697 .698a3.2 3.2 0 0 1 .147 4.382l-.145 .154l-.698 .698a1.2 1.2 0 0 0 -.341 .71l-.008 .135v1a3.2 3.2 0 0 1 -3.018 3.195l-.182 .005h-1a1.2 1.2 0 0 0 -.743 .258l-.1 .09l-.698 .697a3.2 3.2 0 0 1 -4.382 .147l-.154 -.145l-.698 -.698a1.2 1.2 0 0 0 -.71 -.341l-.135 -.008h-1a3.2 3.2 0 0 1 -3.195 -3.018l-.005 -.182v-1a1.2 1.2 0 0 0 -.258 -.743l-.09 -.1l-.697 -.698a3.2 3.2 0 0 1 -.147 -4.382l.145 -.154l.698 -.698a1.2 1.2 0 0 0 .341 -.71l.008 -.135v-1l.005 -.182a3.2 3.2 0 0 1 3.013 -3.013l.182 -.005h1a1.2 1.2 0 0 0 .743 -.258l.1 -.09l.698 -.697a3.2 3.2 0 0 1 2.269 -.944zm3.697 7.282a1 1 0 0 0 -1.414 0l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.32 1.497l2 2l.094 .083a1 1 0 0 0 1.32 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z"
38                              stroke-width="0"
39                              fill="currentColor"
40                            ></path>
41                          </svg>
42                        </span>
43                      </span>
44                    </span>
45                  </div>
46                  <p class="font-normal text-base leading-tight text-gray-500 truncate">
47                    evanyou@gmail.com
48                  </p>
49                </div>
50              </div>
51              <svg
52                xmlns="http://www.w3.org/2000/svg"
53                aria-hidden="true"
54                class="w-6 h-6 text-gray-400 shrink-0"
55                width="24"
56                height="24"
57                viewBox="0 0 24 24"
58                stroke-width="2"
59                stroke="currentColor"
60                fill="none"
61                stroke-linecap="round"
62                stroke-linejoin="round"
63              >
64                <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
65                <path d="M8 9l4 -4l4 4"></path>
66                <path d="M16 15l-4 4l-4 -4"></path>
67              </svg>
68            </div>
69            <div aria-label="navigation" class="py-2">
70              <nav class="grid gap-1">
71                <a
72                  href="/"
73                  class="flex items-center leading-6 space-x-3 py-3 px-4 w-full text-lg text-gray-600 focus:outline-none hover:bg-gray-100 rounded-md"
74                >
75                  <svg
76                    xmlns="http://www.w3.org/2000/svg"
77                    aria-hidden="true"
78                    class="w-7 h-7"
79                    width="24"
80                    height="24"
81                    viewBox="0 0 24 24"
82                    stroke-width="2"
83                    stroke="currentColor"
84                    fill="none"
85                    stroke-linecap="round"
86                    stroke-linejoin="round"
87                  >
88                    <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
89                    <path d="M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0"></path>
90                    <path d="M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2"></path>
91                  </svg>
92                  <span>Account Settings</span>
93                </a>
94                <a
95                  href="/"
96                  class="flex items-center leading-6 space-x-3 py-3 px-4 w-full text-lg text-gray-600 focus:outline-none hover:bg-gray-100 rounded-md"
97                >
98                  <svg
99                    xmlns="http://www.w3.org/2000/svg"
100                    aria-hidden="true"
101                    class="w-7 h-7"
102                    width="24"
103                    height="24"
104                    viewBox="0 0 24 24"
105                    stroke-width="2"
106                    stroke="currentColor"
107                    fill="none"
108                    stroke-linecap="round"
109                    stroke-linejoin="round"
110                  >
111                    <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
112                    <path
113                      d="M9.785 6l8.215 8.215l-2.054 2.054a5.81 5.81 0 1 1 -8.215 -8.215l2.054 -2.054z"
114                    ></path>
115                    <path d="M4 20l3.5 -3.5"></path>
116                    <path d="M15 4l-3.5 3.5"></path>
117                    <path d="M20 9l-3.5 3.5"></path>
118                  </svg>
119                  <span>Integrations</span>
120                </a>
121                <a
122                  href="/"
123                  class="flex items-center leading-6 space-x-3 py-3 px-4 w-full text-lg text-gray-600 focus:outline-none hover:bg-gray-100 rounded-md"
124                >
125                  <svg
126                    xmlns="http://www.w3.org/2000/svg"
127                    aria-hidden="true"
128                    class="w-7 h-7"
129                    width="24"
130                    height="24"
131                    viewBox="0 0 24 24"
132                    stroke-width="2"
133                    stroke="currentColor"
134                    fill="none"
135                    stroke-linecap="round"
136                    stroke-linejoin="round"
137                  >
138                    <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
139                    <path
140                      d="M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z"
141                    ></path>
142                    <path d="M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"></path>
143                  </svg>
144                  <span>Settings</span>
145                </a>
146                <a
147                  href="/"
148                  class="flex items-center leading-6 space-x-3 py-3 px-4 w-full text-lg text-gray-600 focus:outline-none hover:bg-gray-100 rounded-md"
149                >
150                  <svg
151                    xmlns="http://www.w3.org/2000/svg"
152                    aria-hidden="true"
153                    class="w-7 h-7"
154                    width="24"
155                    height="24"
156                    viewBox="0 0 24 24"
157                    stroke-width="2"
158                    stroke="currentColor"
159                    fill="none"
160                    stroke-linecap="round"
161                    stroke-linejoin="round"
162                  >
163                    <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
164                    <path d="M14 3v4a1 1 0 0 0 1 1h4"></path>
165                    <path
166                      d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"
167                    ></path>
168                    <path d="M9 17h6"></path>
169                    <path d="M9 13h6"></path>
170                  </svg>
171                  <span>Guide</span>
172                </a>
173                <a
174                  href="/"
175                  class="flex items-center leading-6 space-x-3 py-3 px-4 w-full text-lg text-gray-600 focus:outline-none hover:bg-gray-100 rounded-md"
176                >
177                  <svg
178                    xmlns="http://www.w3.org/2000/svg"
179                    aria-hidden="true"
180                    class="w-7 h-7"
181                    width="24"
182                    height="24"
183                    viewBox="0 0 24 24"
184                    stroke-width="2"
185                    stroke="currentColor"
186                    fill="none"
187                    stroke-linecap="round"
188                    stroke-linejoin="round"
189                  >
190                    <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
191                    <path
192                      d="M19.875 6.27c.7 .398 1.13 1.143 1.125 1.948v7.284c0 .809 -.443 1.555 -1.158 1.948l-6.75 4.27a2.269 2.269 0 0 1 -2.184 0l-6.75 -4.27a2.225 2.225 0 0 1 -1.158 -1.948v-7.285c0 -.809 .443 -1.554 1.158 -1.947l6.75 -3.98a2.33 2.33 0 0 1 2.25 0l6.75 3.98h-.033z"
193                    ></path>
194                    <path d="M12 16v.01"></path>
195                    <path
196                      d="M12 13a2 2 0 0 0 .914 -3.782a1.98 1.98 0 0 0 -2.414 .483"
197                    ></path>
198                  </svg>
199                  <span>Helper Center</span>
200                </a>
201              </nav>
202            </div>
203            <div aria-label="account-upgrade" class="px-4 py-6">
204              <div class="flex items-center space-x-3">
205                <div class="mr-auto space-y-2">
206                  <p class="font-medium text-xl text-gray-900 leading-none">
207                    Free Plan
208                  </p>
209                  <p class="font-normal text-lg text-gray-500 leading-none">
210                    12,000 views
211                  </p>
212                </div>
213                <button
214                  type="button"
215                  class="inline-flex px-6 leading-6 py-3 rounded-md bg-indigo-50 hover:bg-indigo-50/80 transition-colors duration-200 text-indigo-500 font-medium text-lg"
216                >
217                  Upgrade
218                </button>
219              </div>
220            </div>
221            <div aria-label="footer" class="pt-2">
222              <button
223                type="button"
224                class="flex items-center space-x-3 py-3 px-4 w-full leading-6 text-lg text-gray-600 focus:outline-none hover:bg-gray-100 rounded-md"
225              >
226                <svg
227                  xmlns="http://www.w3.org/2000/svg"
228                  aria-hidden="true"
229                  class="w-7 h-7"
230                  width="24"
231                  height="24"
232                  viewBox="0 0 24 24"
233                  stroke-width="2"
234                  stroke="currentColor"
235                  fill="none"
236                  stroke-linecap="round"
237                  stroke-linejoin="round"
238                >
239                  <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
240                  <path
241                    d="M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2"
242                  ></path>
243                  <path d="M9 12h12l-3 -3"></path>
244                  <path d="M18 15l3 -3"></path>
245                </svg>
246                <span>Logout</span>
247              </button>
248            </div>
249          </div>
250          </div>