OrionWeb.Components (Orion v1.0.7)

View Source

Summary

Functions

Generates a generic error message.

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.

Renders a label.

Translates the errors for a field from a keyword list of errors.

Functions

error(assigns)

Generates a generic error message.

Slots

  • inner_block (required)

input(assigns)

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

<.input field={@form[:email]} type="email" />
<.input name="my-input" errors={["oh no!"]} />

Attributes

  • id (:any) - Defaults to nil.
  • name (:any)
  • label (:string) - Defaults to nil.
  • value (:any)
  • type (:string) - Defaults to "text".
  • field (Phoenix.HTML.FormField) - a form field struct retrieved from the form, for example: @form[:email].
  • errors (:list) - Defaults to [].
  • checked (:boolean) - the checked flag for checkbox inputs.
  • prompt (:string) - the prompt for select inputs. Defaults to nil.
  • options (:list) - the options to pass to Phoenix.HTML.Form.options_for_select/2.
  • multiple (:boolean) - the multiple flag for select inputs. Defaults to false.
  • 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

label(assigns)

Renders a label.

Attributes

  • for (:string) - Defaults to nil.

Slots

  • inner_block (required)

translate_error(arg)

translate_errors(errors, field)

Translates the errors for a field from a keyword list of errors.