DevactionUI.ConfirmDialog (devaction_ui v0.1.0)

Copy Markdown View Source

A modal that asks before something that cannot be taken back, such as publishing a review to GitHub. The LiveView decides when it is there (:if={@confirming}); it takes the focus in, keeps it inside (Phoenix.Component.focus_wrap/1), closes with Esc or the close button, and gives the focus back to what opened it. The two buttons are the caller's, so the confirming one can say what it does ("Publish", not "OK").

Summary

Functions

confirm_dialog(assigns)

Attributes

  • id (:string) (required)
  • title (:string) (required)
  • eyebrow (:string) - a small mono line above the title. Defaults to nil.
  • on_cancel (:any) (required) - an event name or a JS command, run on Esc, the close button and the backdrop.
  • close_label (:string) (required)
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • close_icon (required)
  • inner_block (required) - what will happen, in a sentence or two.
  • actions (required) - the cancel and the confirm buttons.