# `A2UIPhoenix.Inputs`
[🔗](https://github.com/a2ui-elixir/a2ui/blob/v0.1.1/umbrella/apps/a2ui_phoenix/lib/a2ui_phoenix/inputs.ex#L1)

How a form change on a surface becomes a write.

An input of node `ref` is named `a2ui[ref][field]`
(`A2UIPhoenix.Context.input_name/2`), where `field` is normally the
property the input writes. `decode/4` turns the submitted string into
the value the property holds — a boolean for a `CheckBox`, a list for a
`ChoicePicker`, a number for a `Slider`, a combined date-time for a
`DateTimeInput` — or into local UI state (a `ChoicePicker` filter). Any
other component's field is written as the submitted string.

# `decoded`
*since 0.1.0* 

```elixir
@type decoded() :: {:write, String.t(), term()} | {:ui, atom(), term()} | :ignore
```

# `date_enabled?`
*since 0.1.0* 

```elixir
@spec date_enabled?(map()) :: boolean()
```

Whether a `DateTimeInput` picks a date: `enableDate`, which defaults to
true only when `enableTime` is not set (a time-only input picks no
date), as the basic catalog's guide and the reference renderers have
it.

    iex> A2UIPhoenix.Inputs.date_enabled?(%{"enableTime" => true})
    false
    iex> A2UIPhoenix.Inputs.date_enabled?(%{})
    true

# `date_part`
*since 0.1.0* 

```elixir
@spec date_part(String.t()) :: String.t()
```

The `YYYY-MM-DD` part of a date or date-time value (`""` when there is
none).

    iex> A2UIPhoenix.Inputs.date_part("2026-10-14T09:30:00")
    "2026-10-14"
    iex> A2UIPhoenix.Inputs.date_part("09:30")
    ""

# `decode`
*since 0.1.0* 

```elixir
@spec decode(A2UICore.Resolution.Node.t(), String.t(), term(), Date.t()) :: decoded()
```

Decodes the submitted `raw` value of `field` of `node`. `today` fills
in the date when only the time of a date-and-time input is set.

# `time_part`
*since 0.1.0* 

```elixir
@spec time_part(String.t()) :: String.t()
```

The `HH:MM` part of a time or date-time value (`""` when there is none).

    iex> A2UIPhoenix.Inputs.time_part("2026-10-14T09:30:00")
    "09:30"

# `toggle`
*since 0.1.0* 

```elixir
@spec toggle(A2UICore.Resolution.Node.t(), String.t()) ::
  {:write, String.t(), [String.t()]}
```

The new value of a `ChoicePicker` when the chip for `option` is
clicked: toggled in a multiple selection, the only one otherwise.

---

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