Pax.Field.Type behaviour (Pax v0.0.1-dev)

View Source

A field type is a module that implements the Pax.Field.Type behaviour. It is responsible for rendering a Pax.Field and other related behavior

Summary

Callbacks

immutable?(opts)

(optional)
@callback immutable?(opts :: map()) :: boolean()

init(opts)

@callback init(opts :: keyword()) :: map()

input(opts, t, form_field)

(optional)
@callback input(opts :: map(), Pax.Field.t(), form_field :: Phoenix.HTML.Form.field()) ::
  String.t() | Phoenix.LiveView.Rendered.t() | nil

render(opts, value)

@callback render(opts :: map(), value :: any()) ::
  String.t() | Phoenix.LiveView.Rendered.t() | nil