View Source Backpex.HTML.Form (Backpex v0.8.2)

Contains all Backpex form components.

Summary

Components

Generates a generic error message.

Renders an input.

Renders a searchable multi select.

Components

Generates a generic error message.

Slots

  • inner_block (required)

Renders an input.

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.
  • class (:string) - additional class. Defaults to nil.
  • input_class (:string) - additional class for the input element. Defaults to nil.
  • input_wrapper_class (:string) - additional class for the input wrapper element, currently only used in select type. Defaults to nil.
  • field_options (:map) - field options map. Defaults to %{}.
  • hide_errors (:boolean) - if errors should be hidden. Defaults to false.
  • Global attributes are accepted. Supports all globals plus: ["accept", "autocomplete", "capture", "cols", "disabled", "form", "list", "max", "maxlength", "min", "minlength", "multiple", "pattern", "placeholder", "readonly", "required", "rows", "size", "step"].

Slots

  • inner_block

Renders a searchable multi select.

Attributes

  • prompt (:string) (required) - string that will be shown when no option is selected.
  • not_found_text (:string) (required) - string that will be shown when there are no options.
  • options (:list) (required) - a list of options for the select.
  • search_input (:string) (required) - to prefill and or persist the search term for rerendering.
  • event_target (:any) (required) - the target that handles the events of this component.
  • field_options (:map) (required) - field options for the corresponding field.
  • field (:any) (required) - form field the select should be for.
  • selected (:list) (required) - the selected values.
  • show_select_all (:boolean) (required) - whether to display the select all button.
  • show_more (:boolean) (required) - whether there are more options to show.
  • search_event (:string) - the event that will be sent when the search input changes. Defaults to "search".
  • hide_errors (:boolean) - if errors should be hidden. Defaults to false.

Functions

Link to this function

form_errors?(show_errors, form)

View Source
Link to this function

translate_form_errors(form_field, field_options)

View Source