View Source ZoonkWeb.Components.Modal (Zoonk v0.3.0-alpha)

Modal components.

Link to this section Summary

Functions

Renders a modal.

Link to this section Functions

Link to this function

hide_modal(js \\ %JS{}, id)

View Source

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 to false.
  • 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.
Link to this function

show_modal(js \\ %JS{}, id)

View Source

Shows a modal.