Current section
Files
Jump to
Current section
Files
lib/schwiftui/dialog.ex
defmodule SchwiftUi.Dialog do
use SchwiftUI, :component
def dialog(assigns) do
~H"""
<!-- Open the modal using ID.showModal() method -->
<button class="btn" onclick="my_modal_1.showModal()">open modal</button>
<dialog id="my_modal_1" class="modal">
<div class="modal-box">
<h3 class="text-lg font-bold">Hello!</h3>
<p class="py-4">Press ESC key or click the button below to close</p>
<div class="modal-action">
<form method="dialog">
<!-- if there is a button in form, it will close the modal -->
<button class="btn">Close</button>
</form>
</div>
</div>
</dialog>
"""
end
end