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
<div class="p-8 flex items-center justify-center" style="min-height: 300px;"> <h3 class="text-lg font-semibold mb-4">Playground</h3> <div class="relative inline-block" data-controller="better-ui--dropdown--dropdown"> <div aria-haspopup="true" aria-expanded="false" data-action="click->better-ui--dropdown--dropdown#toggle" data-better-ui--dropdown--dropdown-target="trigger"> <button type="button" data-controller="better-ui--button" data-action="click->better-ui--button#handleClick" class="inline-flex items-center justify-center font-medium rounded-lg transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 bg-primary-600 hover:bg-primary-700 active:bg-primary-800 text-grayscale-50 px-4 py-2 text-base gap-2 cursor-pointer"> <span data-better-ui--button-target="spinner" class="hidden"> <svg class="animate-spin w-5 h-5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" aria-hidden="true"> <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle> <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path> </svg> <span class="sr-only">Loading...</span> </span> <span data-better-ui--button-target="content" class=" inline-flex items-center gap-2"> Open Dropdown </span> </button> </div> <div role="menu" hidden data-better-ui--dropdown--dropdown-target="menu" class="absolute z-50 bg-white rounded-md ring-1 ring-grayscale-200 ring-opacity-5 py-1 overflow-hidden focus:outline-none transition-all duration-150 ease-out opacity-0 scale-95 w-56 top-full left-0 mt-1"> <div role="presentation" class="px-3 py-2 text-xs font-semibold uppercase tracking-wider text-grayscale-500"> Actions </div> <a role="menuitem" tabindex="-1" class="flex items-center gap-2 w-full text-left px-3 py-2 text-sm transition-colors duration-150 text-grayscale-700 hover:bg-grayscale-100 hover:text-grayscale-900 cursor-pointer" data-better-ui--dropdown--dropdown-target="item" href="#edit"> <span class="flex-shrink-0"> <svg class="h-4 w-4" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10" /> </svg> </span> <span class="flex-1"> Edit </span> </a> <a role="menuitem" tabindex="-1" class="flex items-center gap-2 w-full text-left px-3 py-2 text-sm transition-colors duration-150 text-grayscale-700 hover:bg-grayscale-100 hover:text-grayscale-900 cursor-pointer" data-better-ui--dropdown--dropdown-target="item" href="#duplicate"> <span class="flex-1">Duplicate</span> </a> <a role="menuitem" tabindex="-1" class="flex items-center gap-2 w-full text-left px-3 py-2 text-sm transition-colors duration-150 text-grayscale-700 opacity-50 cursor-not-allowed pointer-events-none" data-better-ui--dropdown--dropdown-target="item" href="#archive" aria-disabled="true"> <span class="flex-1">Archive (disabled)</span> </a> <div role="separator" class="border-t border-grayscale-200 my-1"></div> <a role="menuitem" tabindex="-1" class="flex items-center gap-2 w-full text-left px-3 py-2 text-sm transition-colors duration-150 text-danger-600 hover:bg-danger-50 hover:text-danger-700 cursor-pointer" data-better-ui--dropdown--dropdown-target="item" href="#delete"> <span class="flex-shrink-0"> <svg class="h-4 w-4" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" d="m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" /> </svg> </span> <span class="flex-1"> Delete </span> </a> </div> </div></div>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
<div class="p-8 flex items-center justify-center" style="min-height: 300px;"> <h3 class="text-lg font-semibold mb-4">Playground</h3> <%= render BetterUi::Dropdown::DropdownComponent.new( size: @size, placement: @placement, shadow: @shadow, auto_close: @auto_close, close_on_item_click: @close_on_item_click ) do |d| %> <% d.with_trigger do %> <%= render(BetterUi::ButtonComponent.new(variant: :primary)) do %>Open Dropdown<% end %> <% end %> <% d.with_header(text: "Actions") %> <% d.with_item(href: "#edit") do |item| %> <% item.with_icon do %> <svg class="h-4 w-4" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10" /> </svg> <% end %> Edit <% end %> <% d.with_item(href: "#duplicate") { "Duplicate" } %> <% d.with_item(href: "#archive", disabled: true) { "Archive (disabled)" } %> <% d.with_divider %> <% d.with_item(href: "#delete", variant: :danger) do |item| %> <% item.with_icon do %> <svg class="h-4 w-4" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" d="m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" /> </svg> <% end %> Delete <% end %> <% end %></div>No notes provided.
| Param | Description | Input |
|---|---|---|
|
— |
|
|
|
— |
|
|
|
— |
|
|
|
— |
|
|
|
— |
|