Using a LiveView component without using "live" in the router

This is more of a general question. I have an existing page and I want to add an interactive component to it. I want to use live view but I don’t want to completely refactor my routes and templates. Is there an easy way to mark a controller as a live view and render a live component within it? From my basic understanding of live view, there would have to be a great deal of refactoring to get this to work. Is there a happier path than moving all my code around? Ideally I would just have that bit of code isolated from the rest of the page and delegate the live bit to its own isolated module. Can this be done?

Yes. live_render can put a LiveView on any non-live page.

1 Like