Form-aware standalone date input component for Phoenix LiveView.
date_field/1 renders a styled <input type="date"> — label, optional
description, date input, and inline validation errors. It is a lightweight
alternative to date_picker/1 (which opens a popover calendar); date_field/1
uses the native browser date picker with no JavaScript.
Usage
<.date_field id="start" name="start_date" label="Start date" />
<.date_field
id="due"
name="due_date"
label="Due date"
description="Must be in the future"
min={Date.to_iso8601(Date.utc_today())}
/>
<.date_field
id="birth"
name="birth_date"
value="1990-01-15"
label="Date of birth"
max="2010-12-31"
errors={["is required"]}
/>Error display
Pass a list of pre-translated error strings via :errors. For form-aware
integration, use phia_input/1 with type="date" or date_picker/1.
Global attributes
The following HTML attributes are forwarded to the <input> element via
the :global attribute: required, placeholder, phx-debounce,
autocomplete, min, max.
Summary
Functions
Attributes
id(:string) - Defaults tonil.name(:string) - Defaults tonil.value(:string) - Defaults tonil.label(:string) - Defaults tonil.description(:string) - Defaults tonil.errors(:list) - Defaults to[].disabled(:boolean) - Defaults tofalse.size(:atom) - Defaults to:default. Must be one of:sm,:default, or:lg.class(:string) - Defaults tonil.- Global attributes are accepted. Supports all globals plus:
["required", "placeholder", "phx-debounce", "autocomplete", "min", "max"].