Pages

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
<button type="button" class="btn" data-testid="dialog-title-btn" commandfor="my-dialog" command="show-modal">
Show Dialog
</button>
<dialog aria-labelledby="dialog-title" class="open:flex overflow-visible flex-col p-0 bg-white shadow-lg backdrop:bg-gray-950/50 w-[36rem] rounded-lg m-auto" data-controller="dialog" data-action="close->dialog#reset" data-testid="dialog-title" id="my-dialog">
<header class="px-6 pt-6 pb-3 flex gap-4 justify-between items-center bg-white rounded-t-lg">
<h1 id="dialog-title" data-testid="dialog-title" class="text-xl leading-6 font-semibold">Dialog Title</h1>
<button aria-label="Close" class="text-secondary hover:text-primary" type="button" data-action="dialog#close">
<!-- Source: Iconoir, added via `bin/add_icon` -->
<svg width="24" height="24" stroke-width="1.5" viewbox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="shrink-0" aria-hidden="true">
<path d="M6.75827 17.2426L12.0009 12M17.2435 6.75736L12.0009 12M12.0009 12L6.75827 6.75736M12.0009 12L17.2435 17.2426" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path>
</svg>
</button> </header>
<div class="px-6 pt-3 flex-auto bg-white pb-3" data-testid="dialog-body">
<p class="text-base leading-5">Content</p>
</div>
<footer class="sticky bottom-0 bg-white px-6 pt-3 pb-6 flex gap-2 justify-end rounded-b-lg">
<button type="button" class="btn" data-testid="cancel-button" data-action="dialog#close">
Cancel
</button>
<button type="button" class="btn btn-primary" data-testid="save-button">
Save
</button>
</footer>
</dialog>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<%= anchor_dialog(
id: "my-dialog",
title: "Dialog Title",
) do |dialog| %>
<% dialog.with_show_button_content("Show Dialog") %>
<% dialog.with_body do %>
<%= anchor_text "Content" %>
<% end %>
<% dialog.with_footer do %>
<%= anchor_button("Cancel", data: { action: "dialog#close" }) %>
<%= anchor_button("Save", variant: :primary) %>
<% end %>
<% end %>