LedgerUI.Components.PasswordInput (LedgerUI v0.2.0)

Copy Markdown View Source

A password field with the eye button that shows what was typed.

<.password_input name="password" placeholder="Enter password" />
<.password_input field={@form[:password]} label="Senha" autocomplete="new-password" />

It is an input/1 of type="password" (it takes every attr of input/1) with a lock at the start and an eye at the end. The button flips the type between password and text, swaps the icon and the accessible name with Phoenix.LiveView.JS, so it needs no hook.

Summary

Functions

Renders the field and the eye.

Functions

password_input(assigns)

Renders the field and the eye.

Attributes

  • id (:string) - Defaults to the field id, then name. Defaults to nil.
  • show_label (:string) - Defaults to "Show the password".
  • hide_label (:string) - Defaults to "Hide the password".
  • class (:any) - Defaults to nil.
  • field (Phoenix.HTML.FormField) - Defaults to nil.
  • name (:string) - Defaults to nil.
  • value (:any) - Defaults to nil.
  • label (:string) - Defaults to nil.
  • help (:string) - Defaults to nil.
  • errors (:list) - Defaults to [].
  • placeholder (:string) - Defaults to nil.
  • disabled (:boolean) - Defaults to false.
  • size (:string) - Defaults to "md". Must be one of "sm", "md", or "lg".
  • variant (:string) - Defaults to "outlined". Must be one of "outlined", "filled", or "plain".
  • state (:string) - Defaults to nil.Must be one of nil, "", "success", or "error".
  • strength (:string) - Draws the strength meter (1 to 4 bars) under the field; scoring the password is yours. Defaults to nil. Must be one of nil, "weak", "fair", "good", or "strong".
  • autocomplete (:string) - Defaults to nil.
  • required (:boolean) - Defaults to nil.
  • minlength (:integer) - Defaults to nil.
  • maxlength (:integer) - Defaults to nil.
  • form (:string) - Defaults to nil.
  • Global attributes are accepted. Supports all globals plus: ["label_hint", "layout", "wrapper_class", "shape", "align", "readonly"].

Slots

  • below
  • label_aside