DaisyUIComponents.Form (DaisyUIComponents v0.8.1)
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.type(:string) - Defaults to"text".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.- 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.