View Source Surface.Component behaviour (surface v0.11.0)
Defines a stateless component.
example
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.
Link to this section Summary
Link to this section Callbacks
@callback render(assigns :: Socket.assigns()) :: Phoenix.LiveView.Rendered.t()