View Source ZoonkWeb.Components.Input (Zoonk v0.1.0-alpha)
Input components.
Link to this section Summary
Functions
Generates a generic error message.
Renders an input with label and error messages.
Renders a label.
Translates an error message using gettext.
Link to this section Functions
Generates a generic error message.
slots
Slots
inner_block
(required)
Renders an input with label and error messages.
A %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
Examples
<.input field={@form[:email]} type="email" />
<.input name="my-input" errors={["oh no!"]} />
attributes
Attributes
id
(:any
) - the id of the input. Defaults tonil
.name
(:any
) - the name of the input.label
(:string
) - the label of the input. Defaults tonil
.value
(:any
) - the value of the input.helper
(:string
) - a helper text to be displayed below the input. Defaults tonil
.type
(:string
) - Defaults to"text"
.field
(Phoenix.HTML.FormField
) - a form field struct retrieved from the form, for example: @form[:email].errors
(:list
) - the errors to display for the input. 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 Form.options_for_select/2.multiple
(:boolean
) - the multiple flag for select inputs. Defaults tofalse
. Global attributes are accepted.
slots
Slots
inner_block
- the inner block of the input.
Renders a label.
attributes
Attributes
for
(:string
) - Defaults tonil
.
slots
Slots
inner_block
(required)
Translates an error message using gettext.