View Source Readme

Spike.Surface provides a wrapper around Surface.LiveView and Surface.LiveComponent, which simplifies working with memory-backed forms, including nested forms that require contextual validation.

installation

Installation

Available in Hex, the package can be installed by adding spike_surface to your list of dependencies in mix.exs:

def deps do
  [
    {:spike_surface, "~> 0.2"}
  ]
end

Documentation can be found at https://hexdocs.pm/spike_surface.

quick-start

Quick start

Once installed in a Phoenix project, open up your *_web.ex file and add the following functions:

  def form_surface_live_view do
    quote do
      use Surface.LiveView,
        layout: {MyAppWeb.LayoutView, "live.html"}

      unquote(view_helpers())

      use Spike.Surface
    end
  end

  def form_surface_live_component do
    quote do
      use Surface.LiveComponent

      unquote(view_helpers())

      use Spike.Surface
    end
  end

See Spike.LiveView for walkthrough, which is applicable here, and also see Spike Example app for Spike + Surface UI examples.

For starting point to build your own form components, see our Components Library.