File tree Expand file tree Collapse file tree
assets/stylesheets/css/components/ui
spec/dummy/test/components/previews/u_i
dropdown_component_preview Expand file tree Collapse file tree Original file line number Diff line number Diff line change 160160 outline-offset : var (--focus-outline-offset-inset );
161161}
162162
163+ /* ==========================================================================
164+ Footer (DropdownComponent with_footer)
165+ A row under the list, outside the scrollable group and the inline search's
166+ filter scope — always visible. Items share the menu-item metrics but read
167+ quieter, as footer actions rather than options.
168+ ========================================================================== */
169+
170+ .dropdown-menu__footer {
171+ @apply flex flex-col self-stretch p-1 border-t border-tertiary;
172+ }
173+
174+ .dropdown-menu__footer : is (a , button ) {
175+ @apply flex items-center w-full justify-start gap-1.5 px-2 py-1.5 min-h-8 rounded-md border-none bg-transparent whitespace-nowrap text-content-secondary font-normal text-sm cursor-pointer leading-5;
176+
177+ & : hover {
178+ @apply bg-secondary text-content;
179+ }
180+
181+ & : focus-visible {
182+ @apply bg-primary;
183+ outline-offset : var (--focus-outline-offset-inset );
184+ }
185+
186+ svg {
187+ @apply shrink-0 size-4 text-inherit;
188+ }
189+ }
190+
163191.dropdown-menu__icon ,
164192.dropdown-menu__list > : is (a , button ) svg {
165193 @apply shrink-0 size-4 text-inherit;
Original file line number Diff line number Diff line change 2929 <% if @searchable %>
3030 < p class ="dropdown-menu__search-empty " data-popover-menu-target ="empty " hidden > No matching options</ p >
3131 <% end %>
32+ <% if footer? %>
33+ < div class ="dropdown-menu__footer "> <%= footer %> </ div >
34+ <% end %>
3235 </ div >
3336 <% end %>
3437 <% end %>
Original file line number Diff line number Diff line change @@ -14,6 +14,9 @@ class Avo::UI::DropdownComponent < Avo::BaseComponent
1414
1515 renders_one :trigger
1616 renders_one :items
17+ # A row pinned under the list — outside the scrollable group and the inline
18+ # search's filter scope, so it stays visible. Popover mode only.
19+ renders_one :footer
1720
1821 # this is used to trigger the dropdown menu from trigger element
1922 # data: {action: component.action} => click->dropdown-menu#toggle
Original file line number Diff line number Diff line change @@ -42,6 +42,11 @@ def default
4242 def searchable
4343 render_with_template ( template : "u_i/dropdown_component_preview/searchable" )
4444 end
45+
46+ # Popover dropdown with a footer row pinned under the (filterable) list
47+ def with_footer
48+ render_with_template ( template : "u_i/dropdown_component_preview/with_footer" )
49+ end
4550 # @!endgroup
4651 end
4752end
Original file line number Diff line number Diff line change 1+ < div class ="border-2 border-gray-200 rounded-md p-4 w-96 flex justify-center items-center ">
2+ <%= render Avo ::UI ::DropdownComponent . new ( popover_mode : true , searchable : true ) do |component | %>
3+ <% component . with_trigger do %>
4+ < button type ="button "
5+ class ="inline-flex items-center justify-center rounded-md p-1 cursor-pointer "
6+ popovertarget ="<%= component . popover_id %> "
7+ aria-haspopup ="menu "
8+ aria-label ="Fruits ">
9+ <%= svg "tabler/outline/dots-vertical" %>
10+ </ button >
11+ <% end %>
12+ <% component . with_items do %>
13+ <% %w[ Apple Avocado Banana Cherry Mango Peach Pear Plum ] . each do |fruit | %>
14+ <%= button_tag ( fruit , type : "button" ) %>
15+ <% end %>
16+ <% end %>
17+ <% component . with_footer do %>
18+ <%= link_to "#" do %>
19+ <%= svg "tabler/outline/external-link" %>
20+ All fruits
21+ <% end %>
22+ <% end %>
23+ <% end %>
24+ </ div >
You can’t perform that action at this time.
0 commit comments