How to Toggle Phoenix Modal Component show/hide

For anyone asking the same question it’s two lines of code and requires JavaScript. I spent a day and a half going in circles over this nonsense. It has nothing to do with the show command. The show/hide feature pertains to the ID assignment and that it needs the JS module.




  <.modal
    id="user-modal"
    >
  </.modal>


<button phx-click={show_modal("user-modal")}>  Click me </button>
5 Likes