View Source PetalComponents.Modal (petal_components v1.9.2)

Summary

Functions

Attributes

  • id (:string) - modal id. Defaults to "modal".
  • hide (:boolean) - modal is hidden. Defaults to false.
  • title (:string) - modal title. Defaults to nil.
  • class (:string) - modal class. Defaults to nil.
  • close_modal_target (:string) - close_modal_target allows you to target a specific live component for the close event to go to. eg: close_modal_target={@myself}. Defaults to nil.
  • close_on_click_away (:boolean) - whether the modal should close when a user clicks away. Defaults to true.
  • close_on_escape (:boolean) - whether the modal should close when a user hits escape. Defaults to true.
  • hide_close_button (:boolean) - whether or not the modal should have a close button in the header. Defaults to false.
  • on_cancel (Phoenix.LiveView.JS) - a JS function to execute when the modal is closed. Defaults to pushing close_modal event. Defaults to %Phoenix.LiveView.JS{ops: [["exec", ["data-cancel-default"]]]}.
  • max_width (:string) - modal max width. Defaults to "md".
  • Global attributes are accepted.

Slots

  • inner_block

Functions

Link to this function

hide_modal(id \\ "modal")

View Source

Attributes

  • id (:string) - modal id. Defaults to "modal".
  • hide (:boolean) - modal is hidden. Defaults to false.
  • title (:string) - modal title. Defaults to nil.
  • class (:string) - modal class. Defaults to nil.
  • close_modal_target (:string) - close_modal_target allows you to target a specific live component for the close event to go to. eg: close_modal_target={@myself}. Defaults to nil.
  • close_on_click_away (:boolean) - whether the modal should close when a user clicks away. Defaults to true.
  • close_on_escape (:boolean) - whether the modal should close when a user hits escape. Defaults to true.
  • hide_close_button (:boolean) - whether or not the modal should have a close button in the header. Defaults to false.
  • on_cancel (Phoenix.LiveView.JS) - a JS function to execute when the modal is closed. Defaults to pushing close_modal event. Defaults to %Phoenix.LiveView.JS{ops: [["exec", ["data-cancel-default"]]]}.
  • max_width (:string) - modal max width. Defaults to "md".
  • Global attributes are accepted.

Slots

  • inner_block
Link to this function

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

View Source