DaisyUIComponents.Form (DaisyUIComponents v0.9.3)
View SourceForm component helpers
Summary
Functions
Generates a generic error message.
Renders an input with label and error messages.
Renders a simple form. This component was extracted from the original Phoenix CoreComponents.
Functions
Generates a generic error message.
Attributes
field(Phoenix.HTML.FormField) - a form field struct retrieved from the form, for example: @form[:email].
Slots
inner_block
Renders an input with label and error messages.
A %Phoenix.HTML.Form{} and field name may be passed to the input
to build input names and error messages, or all the attributes and
errors may be passed explicitly.
Examples
<.form_input field={@form[:email]} type="email" />
<.form_input name="my-input" errors={["oh no!"]} />Attributes
id(:any) - Defaults tonil.name(:any)label(:string) - Defaults tonil.value(:any)color(:string) - Defaults tonil.Must be one of"primary","secondary","accent","info","success","warning","error", ornil.type(:string) - Defaults to"text". Must be one of"checkbox","color","date","datetime-local","email","file","hidden","month","number","password","range","radio","search","select","autocomplete","tel","text","textarea","time","url","week","toggle","checkbox_group", or"radio_group".field(Phoenix.HTML.FormField) - a form field struct retrieved from the form, for example: @form[:email].class(:string) - Defaults tonil.errors(:list) - Defaults to[].checked(:boolean) - the checked flag for checkbox inputs.prompt(:string) - the prompt for select inputs. Defaults tonil.options(:list) - the options to pass to Phoenix.HTML.Form.options_for_select/2.multiple(:boolean) - the multiple flag for select inputs. Defaults tofalse.on_query(:any) - the JS event to trigger when a value is searched in autocomplete inputs.- Global attributes are accepted. Supports all globals plus:
["autocomplete", "cols", "disabled", "form", "list", "max", "maxlength", "min", "minlength", "pattern", "placeholder", "readonly", "required", "rows", "size", "step"].
Slots
inner_block
Renders a simple form. This component was extracted from the original Phoenix CoreComponents.
Examples
<.simple_form for={@form} phx-change="validate" phx-submit="save">
<.input field={@form[:email]} label="Email"/>
<.input field={@form[:username]} label="Username" />
<:actions>
<.button>Save</.button>
</:actions>
</.simple_form>Attributes
for(:any) (required) - the datastructure for the form.as(:any) - the server side parameter to collect all input under. Defaults tonil.- Global attributes are accepted. the arbitrary HTML attributes to apply to the form tag. Supports all globals plus:
["autocomplete", "name", "rel", "action", "enctype", "method", "novalidate", "target"].
Slots
inner_block(required)actions- the slot for form actions, such as a submit button.