Skua.Components.Phone (Skua v0.1.0)

Copy Markdown View Source

An international phone field — country picker + national number input that writes a canonical E.164 value (e.g. "+15555550100") into a hidden input for phx-change/phx-submit.

<.phone field={@form[:phone]} label="Phone" />
<.phone field={@form[:phone]} country="GB" required />

Pairs with the Skua.Phone harness: validate with Skua.Phone.validate_phone(changeset, :phone, required: true). The country dataset is rendered alongside the field (no extra dependency, no bloat to the shared JS bundle), so the picker is fully self-contained in the SkuaPhone hook.

Summary

Functions

phone(assigns)

Attributes

  • field (Phoenix.HTML.FormField) - Defaults to nil.
  • id (:string) - Defaults to nil.
  • name (:string) - Defaults to nil.
  • value (:any) - Defaults to nil.
  • country (:string) - default ISO-3166 alpha-2 country. Defaults to "US".
  • label (:string) - Defaults to nil.
  • hint (:string) - Defaults to nil.
  • errors (:list) - Defaults to nil.
  • required (:boolean) - Defaults to false.
  • placeholder (:string) - Defaults to "Phone number".
  • Global attributes are accepted.