View Source PlausibleWeb.Live.Components.Form (Plausible v0.0.1)

Generic components stolen from mix phx.new templates

Summary

Functions

Generates a generic error message.

Renders an input with label and error messages.

Attributes

  • id (:string) (required)
  • class (:string) - Defaults to "".
  • name (:string) (required)
  • label (:string) (required)
  • value (:string) - Defaults to "".
  • Global attributes are accepted.

Renders a label.

Attributes

  • id (:any) - Defaults to nil.
  • label (:string) - Defaults to nil.
  • field (Phoenix.HTML.FormField) (required) - a form field struct retrieved from the form, for example: @form[:password].
  • strength (:any)
  • Global attributes are accepted.

Attributes

  • minimum (:integer) (required)
  • class (:any)
  • ok_class (:any)
  • error_class (:any)
  • field (Phoenix.HTML.FormField) (required) - a form field struct retrieved from the form, for example: @form[:password].

Attributes

  • score (:integer) - Defaults to 0.
  • warning (:string) - Defaults to "".
  • suggestions (:list) - Defaults to [].

Functions

Generates a generic error message.

Slots

  • inner_block (required)

Renders an input with label and error messages.

A Phoenix.HTML.FormField may be passed as argument, which is used to retrieve the input name, id, and values. Otherwise all attributes 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.

Slots

  • inner_block
Link to this function

input_with_clipboard(assigns)

View Source

Attributes

  • id (:string) (required)
  • class (:string) - Defaults to "".
  • name (:string) (required)
  • label (:string) (required)
  • value (:string) - Defaults to "".
  • Global attributes are accepted.

Renders a label.

Attributes

  • for (:string) - Defaults to nil.

Slots

  • inner_block (required)
Link to this function

password_input_with_strength(assigns)

View Source

Attributes

  • id (:any) - Defaults to nil.
  • label (:string) - Defaults to nil.
  • field (Phoenix.HTML.FormField) (required) - a form field struct retrieved from the form, for example: @form[:password].
  • strength (:any)
  • Global attributes are accepted.
Link to this function

password_length_hint(assigns)

View Source

Attributes

  • minimum (:integer) (required)
  • class (:any)
  • ok_class (:any)
  • error_class (:any)
  • field (Phoenix.HTML.FormField) (required) - a form field struct retrieved from the form, for example: @form[:password].

Attributes

  • score (:integer) - Defaults to 0.
  • warning (:string) - Defaults to "".
  • suggestions (:list) - Defaults to [].