View Source Surface.Component behaviour (Surface v0.12.0)
Defines a stateless component.
Example
defmodule Button do
use Surface.Component
prop click, :event
def render(assigns) do
~F"""
<button class="button" :on-click={@click}>
<#slot/>
</button>
"""
end
end
Note: Stateless components cannot handle Phoenix LiveView events. If you need to handle them, please use a
Surface.LiveComponent
instead.
Summary
Callbacks
@callback render(assigns :: Socket.assigns()) :: Phoenix.LiveView.Rendered.t()