surface v0.1.0-alpha.2 Surface.Component behaviour View Source
Defines a stateless component.
Example
defmodule Button do
use Surface.Component
property click, :event
def render(assigns) do
~H"""
<button class="button" phx-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
Callbacks
This optional callback is invoked in order to set up a context that can be retrieved for any descendent component.
Link to this section Callbacks
Specs
This optional callback is invoked in order to set up a context that can be retrieved for any descendent component.