Is Surface an all or nothing thing?

I’m experimenting with Surface, and I converted a LiveComponent into a Surface component. Now I want to use that in an existing LiveView, replacing

<%= live_component @socket, MyComponent, foo: @foo %>

in the .heex file with

<MyComponent foo=@foo />

All the examples I can find show the top-level pages embedding surface components also using Surface.LiveView - is it a requirement that everything using a surface component be itself converted to a surface component, or is there a way to just embed a surface component into an existing LiveView?

Hi @martindemello!

Currently, Liveview doesn’t have built-in support for some of Surface’s most used features, like Slots. That means if you’re using any of those features, the component will not work as expected when injected in a heex template . However, we’re already working on bringing those features to LV’s core. Our goal is to make any component built with any template engine compatible with each other.

For details, see Surface and Phoenix LiveView - what comes next? - Dashbit Blog.

9 Likes