Surface.Component (surface v0.4.0) View Source

Defines a stateless component.

Example

defmodule Button do
  use Surface.Component

  prop 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.