How to implement a Modal in Phoenix LiveView

I need to create a modal to show the profile of a user, but i don’t know how i can do this implementation within the live view. Does anyone know, or have you used something similar? :cry:

:wave:

http://blog.pthompson.org/phoenix-liveview-livecomponent-modal might be relevant.

5 Likes

The blog post above might be outdated. For a “fresher” approach see the modal generated in a new live view project:

mix phx.new --live app
mix phx.gen.live Accounts User users name:string age:integer

The relevant file is in lib/app_web/live/modal_component.ex.

https://hexdocs.pm/phoenix/Mix.Tasks.Phx.Gen.Live.html#content

4 Likes