View Source ZoonkWeb.Components.Modal (Zoonk v0.3.0-alpha)
Modal components.
Link to this section Summary
Link to this section Functions
Hides a modal.
Renders a modal.
examples
Examples
<.modal id="confirm-modal">
This is a modal.
</.modal>
JS commands may be passed to the :on_cancel
to configure
the closing/cancel event, for example:
<.modal id="confirm" on_cancel={JS.navigate(~p"/posts")}>
This is another modal.
</.modal>
attributes
Attributes
id
(:string
) (required) - the id of the modal container.show
(:boolean
) - whether to show the modal on mount. Defaults tofalse
.on_cancel
(Phoenix.LiveView.JS
) - the JS command to run when the modal is canceled. Defaults to%Phoenix.LiveView.JS{ops: []}
.
slots
Slots
inner_block
(required) - the inner block that renders the modal content.actions
- the slot for modal actions, such as a confirm and cancel.
Shows a modal.