x
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
<ul class="midwest-dropdown-menu align--bottom-start midwest-dropdown" id="dropdown-125b0" role="menu" popover="auto" style="position-anchor: --dropdown-125b0;" data-controller="midwest-dropdown" data-dropdown-computed-positioning-value="false" data-dropdown-align-value="bottom-start"> <button type="button" role="menuitem" popovertarget="dropdown-125b0" popovertargetaction="hide" aria-label="Close menu" class="midwest-button variant-default size-default theme-primary midwest-dropdown-close" name="button"> <span class="midwest-button-content"> <div class="midwest-icon text-2xl"> <div class="midwest-icon-inner"> <svg xmlns="http://www.w3.org/2000/svg" class="Midwest-Icon__Svg" viewbox="0 0 512 512" focusable="false" role="img" aria-label="Close"><title>Close</title> <path d="M289.94 256l95-95A24 24 0 00351 127l-95 95-95-95a24 24 0 00-34 34l95 95-95 95a24 24 0 1034 34l95-95 95 95a24 24 0 0034-34z"></path></svg> </div> </div> </span> <div class="midwest-loading-icon" role="img" aria-label="Loading" aria-hidden="true" style="display: none"> <div class="midwest-loading-icon-inner"> <!-- By Sam Herbert (@sherb), for everyone. More @ http://goo.gl/7AJzbL --> <svg viewbox="0 0 120 30" xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="Midwest-LoadingIcon__Svg" focusable="false" aria-hidden="true"> <circle cx="15" cy="15" r="15"> <animate attributename="r" from="15" to="15" begin="0s" dur="0.8s" values="15;9;15" calcmode="linear" repeatcount="indefinite"></animate> <animate attributename="fill-opacity" from="1" to="1" begin="0s" dur="0.8s" values="1;.5;1" calcmode="linear" repeatcount="indefinite"></animate> </circle> <circle cx="60" cy="15" r="9" fill-opacity="0.3"> <animate attributename="r" from="9" to="9" begin="0s" dur="0.8s" values="9;15;9" calcmode="linear" repeatcount="indefinite"></animate> <animate attributename="fill-opacity" from="0.5" to="0.5" begin="0s" dur="0.8s" values=".5;1;.5" calcmode="linear" repeatcount="indefinite"></animate> </circle> <circle cx="105" cy="15" r="15"> <animate attributename="r" from="15" to="15" begin="0s" dur="0.8s" values="15;9;15" calcmode="linear" repeatcount="indefinite"></animate> <animate attributename="fill-opacity" from="1" to="1" begin="0s" dur="0.8s" values="1;.5;1" calcmode="linear" repeatcount="indefinite"></animate> </circle> </svg> </div> </div> </button> <label class="midwest-label " for=""> <div class="midwest-dropdown-item as-header"> <span class="midwest-avatar size-xs theme-red shape-circle" title="You tabbed on an Avatar for William A. Nova"> <div class="letter" title="William A. Nova"> WN </div> </span> <h6>William A. Nova</h6> </div> </label> <label class="midwest-label " for=""> <a class="midwest-dropdown-item as-link" role="menuitem" href="#"> nice </a> </label> <label class="midwest-label " for=""> <div class="midwest-dropdown-item as-header"> <h6>Header</h6> </div> </label> <label class="midwest-label " for=""> <a class="midwest-dropdown-item as-link" role="menuitem" href="#"> nice </a> </label> <label class="midwest-label " for=""> <span class="midwest-tooltip" data-controller="midwest-tooltip"> <span id="tooltip-trigger-125c0" class="midwest-tooltip-trigger" style="anchor-name: --tooltip-125c0" data-action="mouseenter->midwest-tooltip#show mouseleave->midwest-tooltip#hide focus->midwest-tooltip#show blur->midwest-tooltip#hide" aria-describedby="tooltip-125c0"> <a class="midwest-dropdown-item as-link" role="menuitem" href="#"> With tooltip </a> </span> <span id="tooltip-125c0" popover="manual" role="tooltip" class="midwest-tooltip-popover placement-top" style="position-anchor: --tooltip-125c0" data-midwest-tooltip-target="popover"> Extra info on hover </span></span> </label> <label class="midwest-label " for=""> <div id="confirmation-125c8" popover="auto" class="midwest-popover anchored midwest-confirmation" style="position-anchor: --confirmation-125c8-button; anchor-name: --confirmation-125c8"> <article data-controller="midwest-card" class="midwest-card min-w-[20rem]"> <div class="wrap"> <header> <h4>Confirmation</h4> </header> <section> <p class="w-full text-wrap">Are you sure you want to delete this?</p> </section> <footer> <button popovertarget="confirmation-125c8" type="button" autofocus="autofocus" class="midwest-button variant-outline size-default theme-primary" name="button" value="false"> <span class="midwest-button-content"><span class="translation_missing" title="translation missing: en.midwest.confirmation_component.no, locale: en">No</span></span> <div class="midwest-loading-icon" role="img" aria-label="Loading" aria-hidden="true" style="display: none"> <div class="midwest-loading-icon-inner"> <!-- By Sam Herbert (@sherb), for everyone. More @ http://goo.gl/7AJzbL --> <svg viewbox="0 0 120 30" xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="Midwest-LoadingIcon__Svg" focusable="false" aria-hidden="true"> <circle cx="15" cy="15" r="15"> <animate attributename="r" from="15" to="15" begin="0s" dur="0.8s" values="15;9;15" calcmode="linear" repeatcount="indefinite"></animate> <animate attributename="fill-opacity" from="1" to="1" begin="0s" dur="0.8s" values="1;.5;1" calcmode="linear" repeatcount="indefinite"></animate> </circle> <circle cx="60" cy="15" r="9" fill-opacity="0.3"> <animate attributename="r" from="9" to="9" begin="0s" dur="0.8s" values="9;15;9" calcmode="linear" repeatcount="indefinite"></animate> <animate attributename="fill-opacity" from="0.5" to="0.5" begin="0s" dur="0.8s" values=".5;1;.5" calcmode="linear" repeatcount="indefinite"></animate> </circle> <circle cx="105" cy="15" r="15"> <animate attributename="r" from="15" to="15" begin="0s" dur="0.8s" values="15;9;15" calcmode="linear" repeatcount="indefinite"></animate> <animate attributename="fill-opacity" from="1" to="1" begin="0s" dur="0.8s" values="1;.5;1" calcmode="linear" repeatcount="indefinite"></animate> </circle> </svg> </div> </div> </button> <a type="button" path="#" class="midwest-button variant-primary size-default theme-primary" name="button" rel="nofollow" data-method="delete" href="#"> <span class="midwest-button-content"><span class="translation_missing" title="translation missing: en.midwest.confirmation_component.yes, locale: en">Yes</span></span> <div class="midwest-loading-icon" role="img" aria-label="Loading" aria-hidden="true" style="display: none"> <div class="midwest-loading-icon-inner"> <!-- By Sam Herbert (@sherb), for everyone. More @ http://goo.gl/7AJzbL --> <svg viewbox="0 0 120 30" xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="Midwest-LoadingIcon__Svg" focusable="false" aria-hidden="true"> <circle cx="15" cy="15" r="15"> <animate attributename="r" from="15" to="15" begin="0s" dur="0.8s" values="15;9;15" calcmode="linear" repeatcount="indefinite"></animate> <animate attributename="fill-opacity" from="1" to="1" begin="0s" dur="0.8s" values="1;.5;1" calcmode="linear" repeatcount="indefinite"></animate> </circle> <circle cx="60" cy="15" r="9" fill-opacity="0.3"> <animate attributename="r" from="9" to="9" begin="0s" dur="0.8s" values="9;15;9" calcmode="linear" repeatcount="indefinite"></animate> <animate attributename="fill-opacity" from="0.5" to="0.5" begin="0s" dur="0.8s" values=".5;1;.5" calcmode="linear" repeatcount="indefinite"></animate> </circle> <circle cx="105" cy="15" r="15"> <animate attributename="r" from="15" to="15" begin="0s" dur="0.8s" values="15;9;15" calcmode="linear" repeatcount="indefinite"></animate> <animate attributename="fill-opacity" from="1" to="1" begin="0s" dur="0.8s" values="1;.5;1" calcmode="linear" repeatcount="indefinite"></animate> </circle> </svg> </div> </div> </a> </footer> </div> </article> </div> <button class="midwest-dropdown-item as-button" role="menuitem" popovertarget="confirmation-125c8" style="anchor-name: --confirmation-125c8-button;"> Delete </button> </label> <label class="midwest-label " for=""> <button class="midwest-dropdown-item as-nested" role="menuitem" aria-haspopup="menu" popovertarget="dropdown-125d0" style="anchor-name: --dropdown-125d0;"> nice <div class="midwest-icon "> <div class="midwest-icon-inner"> <svg xmlns="http://www.w3.org/2000/svg" class="Midwest-Icon__Svg" viewbox="0 0 512 512" focusable="false" role="img" aria-label="Menu"><title>Menu</title> <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="48" d="M88 152h336M88 256h336M88 360h336"></path></svg> </div> </div> </button> <ul class="midwest-dropdown-menu align--right midwest-dropdown-submenu" id="dropdown-125d0" role="menu" popover="auto" style="position-anchor: --dropdown-125d0;" data-controller="midwest-dropdown" data-dropdown-computed-positioning-value="false" data-dropdown-align-value="right"> <button type="button" role="menuitem" popovertarget="dropdown-125d0" popovertargetaction="hide" aria-label="Close menu" class="midwest-button variant-default size-default theme-primary midwest-dropdown-close" name="button"> <span class="midwest-button-content"> <div class="midwest-icon text-2xl"> <div class="midwest-icon-inner"> <svg xmlns="http://www.w3.org/2000/svg" class="Midwest-Icon__Svg" viewbox="0 0 512 512" focusable="false" role="img" aria-label="Close"><title>Close</title> <path d="M289.94 256l95-95A24 24 0 00351 127l-95 95-95-95a24 24 0 00-34 34l95 95-95 95a24 24 0 1034 34l95-95 95 95a24 24 0 0034-34z"></path></svg> </div> </div> </span> <div class="midwest-loading-icon" role="img" aria-label="Loading" aria-hidden="true" style="display: none"> <div class="midwest-loading-icon-inner"> <!-- By Sam Herbert (@sherb), for everyone. More @ http://goo.gl/7AJzbL --> <svg viewbox="0 0 120 30" xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="Midwest-LoadingIcon__Svg" focusable="false" aria-hidden="true"> <circle cx="15" cy="15" r="15"> <animate attributename="r" from="15" to="15" begin="0s" dur="0.8s" values="15;9;15" calcmode="linear" repeatcount="indefinite"></animate> <animate attributename="fill-opacity" from="1" to="1" begin="0s" dur="0.8s" values="1;.5;1" calcmode="linear" repeatcount="indefinite"></animate> </circle> <circle cx="60" cy="15" r="9" fill-opacity="0.3"> <animate attributename="r" from="9" to="9" begin="0s" dur="0.8s" values="9;15;9" calcmode="linear" repeatcount="indefinite"></animate> <animate attributename="fill-opacity" from="0.5" to="0.5" begin="0s" dur="0.8s" values=".5;1;.5" calcmode="linear" repeatcount="indefinite"></animate> </circle> <circle cx="105" cy="15" r="15"> <animate attributename="r" from="15" to="15" begin="0s" dur="0.8s" values="15;9;15" calcmode="linear" repeatcount="indefinite"></animate> <animate attributename="fill-opacity" from="1" to="1" begin="0s" dur="0.8s" values="1;.5;1" calcmode="linear" repeatcount="indefinite"></animate> </circle> </svg> </div> </div> </button> <label class="midwest-label " for=""> <div class="midwest-dropdown-item as-header"> <h6>Nested Content</h6> </div> </label> <label class="midwest-label " for=""> <a class="midwest-dropdown-item as-link" role="menuitem" href="#"> nice </a> </label> <label class="midwest-label " for=""> <a class="midwest-dropdown-item as-link" role="menuitem" href="#"> nice </a> </label> <label class="midwest-label " for=""> <button class="midwest-dropdown-item as-nested" role="menuitem" aria-haspopup="menu" popovertarget="dropdown-125d8" style="anchor-name: --dropdown-125d8;"> nice <div class="midwest-icon "> <div class="midwest-icon-inner"> <svg xmlns="http://www.w3.org/2000/svg" class="Midwest-Icon__Svg" viewbox="0 0 512 512" focusable="false" role="img" aria-label="Menu"><title>Menu</title> <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="48" d="M88 152h336M88 256h336M88 360h336"></path></svg> </div> </div> </button> <ul class="midwest-dropdown-menu align--right midwest-dropdown-submenu" id="dropdown-125d8" role="menu" popover="auto" style="position-anchor: --dropdown-125d8;" data-controller="midwest-dropdown" data-dropdown-computed-positioning-value="false" data-dropdown-align-value="right"> <button type="button" role="menuitem" popovertarget="dropdown-125d8" popovertargetaction="hide" aria-label="Close menu" class="midwest-button variant-default size-default theme-primary midwest-dropdown-close" name="button"> <span class="midwest-button-content"> <div class="midwest-icon text-2xl"> <div class="midwest-icon-inner"> <svg xmlns="http://www.w3.org/2000/svg" class="Midwest-Icon__Svg" viewbox="0 0 512 512" focusable="false" role="img" aria-label="Close"><title>Close</title> <path d="M289.94 256l95-95A24 24 0 00351 127l-95 95-95-95a24 24 0 00-34 34l95 95-95 95a24 24 0 1034 34l95-95 95 95a24 24 0 0034-34z"></path></svg> </div> </div> </span> <div class="midwest-loading-icon" role="img" aria-label="Loading" aria-hidden="true" style="display: none"> <div class="midwest-loading-icon-inner"> <!-- By Sam Herbert (@sherb), for everyone. More @ http://goo.gl/7AJzbL --> <svg viewbox="0 0 120 30" xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="Midwest-LoadingIcon__Svg" focusable="false" aria-hidden="true"> <circle cx="15" cy="15" r="15"> <animate attributename="r" from="15" to="15" begin="0s" dur="0.8s" values="15;9;15" calcmode="linear" repeatcount="indefinite"></animate> <animate attributename="fill-opacity" from="1" to="1" begin="0s" dur="0.8s" values="1;.5;1" calcmode="linear" repeatcount="indefinite"></animate> </circle> <circle cx="60" cy="15" r="9" fill-opacity="0.3"> <animate attributename="r" from="9" to="9" begin="0s" dur="0.8s" values="9;15;9" calcmode="linear" repeatcount="indefinite"></animate> <animate attributename="fill-opacity" from="0.5" to="0.5" begin="0s" dur="0.8s" values=".5;1;.5" calcmode="linear" repeatcount="indefinite"></animate> </circle> <circle cx="105" cy="15" r="15"> <animate attributename="r" from="15" to="15" begin="0s" dur="0.8s" values="15;9;15" calcmode="linear" repeatcount="indefinite"></animate> <animate attributename="fill-opacity" from="1" to="1" begin="0s" dur="0.8s" values="1;.5;1" calcmode="linear" repeatcount="indefinite"></animate> </circle> </svg> </div> </div> </button> <label class="midwest-label " for=""> <div class="midwest-dropdown-item as-header"> <h6>Nested Content</h6> </div> </label> <label class="midwest-label " for=""> <a class="midwest-dropdown-item as-link" role="menuitem" href="#"> nice </a> </label> <label class="midwest-label " for=""> <a class="midwest-dropdown-item as-link" role="menuitem" href="#"> nice </a> </label> </ul> </label> </ul> </label></ul><button class="flex gap-2 items-center midwest-dropdown-button w-auto" popovertarget="dropdown-125b0" style="anchor-name: --dropdown-125b0;" aria-haspopup="menu" aria-expanded="false" aria-controls="dropdown-125b0"> <div class="flex gap-2 p-2 align-center"> <span class="midwest-avatar size-xs theme-red shape-rectangle" title="You tabbed on an Avatar for Midwest Design"> <div class="letter" title="Midwest Design"> MD </div> </span> <h6>Unabridged Software</h6> </div> <div class="layer-children open-indicator"> <div class="midwest-icon opened"> <div class="midwest-icon-inner"> <svg xmlns="http://www.w3.org/2000/svg" class="Midwest-Icon__Svg" viewbox="0 0 512 512" focusable="false" role="img" aria-label="Close"><title>Close</title> <path d="M289.94 256l95-95A24 24 0 00351 127l-95 95-95-95a24 24 0 00-34 34l95 95-95 95a24 24 0 1034 34l95-95 95 95a24 24 0 0034-34z"></path></svg> </div> </div> <div class="midwest-icon closed"> <div class="midwest-icon-inner"> <svg xmlns="http://www.w3.org/2000/svg" class="Midwest-Icon__Svg" viewbox="0 0 512 512" focusable="false" role="img" aria-label="Chevron forward"><title>Chevron forward</title> <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48" d="M184 112l144 144-144 144"></path></svg> </div> </div> </div></button>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<%= midwest_dropdown(title: "hello") do |d| %> <% d.with_toggle do %> <div class="flex gap-2 p-2 align-center"> <%= midwest_avatar(shape: :rectangle, size: :xs) %> <h6>Unabridged Software</h6> </div> <% end %> <% d.with_item as: :header, label: "nice", path: "#" do %> <%= midwest_avatar(shape: :circle, size: :xs, name: "William A. Nova") %> <h6>William A. Nova</h6> <% end %> <% d.with_item label: "nice", path: "#" %> <% d.with_item as: :header do %> <h6>Header</h6> <% end %> <% d.with_item label: "nice", path: "#" %> <% d.with_item label: "With tooltip", path: "#", tooltip: "Extra info on hover" %> <% d.with_item label: "Delete", as: :button, confirm: "Are you sure you want to delete this?", confirm_args: { path: "#", method: :delete } %> <% d.with_item as: :nested, label: "nice", align: "right" do |item| %> <% item.with_nested_item as: :header do %> <h6>Nested Content</h6> <% end %> <% item.with_nested_item label: "nice", path: "#" %> <% item.with_nested_item label: "nice", path: "#" %> <% item.with_nested_item as: :nested, label: "nice", align: "right" do |subitem| %> <% subitem.with_nested_item as: :header do %> <h6>Nested Content</h6> <% end %> <% subitem.with_nested_item label: "nice", path: "#" %> <% subitem.with_nested_item label: "nice", path: "#" %> <% end %> <% end %><% end %>Custom Button
How to use the toggle slot to provide a custom toggle button for a dropdown.
No params configured.
No assets to display.
Add a .js or .css file alongside the component to see it here.
Figma embed for Dropdown/custom_button
Annotate a preview to embed its Figma design here:
@figma "https://figma.com/..."