# `Arc.LiveView.Form`
[🔗](https://github.com/Cratis/Arc.Elixir/blob/main/lib/arc/live_view/form.ex#L5)

A command as a Phoenix form.

`Arc.LiveView.Form` implements `Phoenix.HTML.FormData`, so `Phoenix.Component.to_form/2`, `<.form>`
and the generated `<.input>` core component work with a command directly. Errors from the
Arc pipeline appear on the matching field, using the member names of the validation results.

Form values arrive as strings. Empty strings become `nil` for fields that are not strings, and
keys are `snake_case` field names, which Arc converts to the wire names it binds from.

You normally use it through `Arc.LiveView.assign_form/4`, `validate_form/3` and `submit_form/3`.

# `t`

```elixir
@type t() :: %Arc.LiveView.Form{
  action: atom() | nil,
  command: module(),
  errors: [{atom(), {String.t(), keyword()}}],
  params: map()
}
```

# `new`

```elixir
@spec new(module(), map()) :: t()
```

A new, empty form for `command`, optionally prefilled with `params`.

# `wire`

```elixir
@spec wire(module(), map()) :: map()
```

Converts form params to the wire map the pipeline binds: `snake_case` keys become `camelCase`,
and blank values of non-string fields become `nil`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
