DevactionUI.ConfirmDialog (devaction_ui v0.2.3)

Copy Markdown View Source

A modal that asks before something that cannot be taken back, such as publishing a review to GitHub. It is a DevactionUI.Modal with the question as the title, the explanation as the text and the two buttons in the footer, so it takes the focus in, keeps it inside, closes with Esc and a click outside (unless dismissible={false}) and gives the focus back to what opened it. The buttons are the caller's, so the confirming one can say what it does ("Publish", not "OK"). There is no close button in the corner unless close_label is given.

Summary

Functions

confirm_dialog(assigns)

Attributes

  • id (:string) (required)
  • title (:string) (required)
  • size (:atom) - Defaults to :md. Must be one of :sm, :md, or :lg.
  • tone (:atom) - the tone of the icon tile. Defaults to :warn. Must be one of :neutral, :info, :ok, :warn, or :risk.
  • dismissible (:boolean) - a click outside closes it. Defaults to true.
  • on_cancel (:any) (required) - an event name or a JS command, run on Esc, the close button and a click outside.
  • close_label (:string) - when given, a close button is drawn in the corner. Defaults to nil.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

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