PhoenixPaper.NumberField (PhoenixPaper v0.1.0)

Copy Markdown View Source

A Material Design number field (pp_number_field/1) — a numeric input with increment/decrement stepper buttons.

The steppers use two lines of vanilla inline JS (stepUp()/stepDown() plus dispatching a real input event so phx-change/phx-debounce on the field still fire) — no JS hook, no bundler, no extra dependency.

Summary

Functions

pp_number_field(assigns)

Attributes

  • id (:any) - Defaults to nil.
  • name (:any) - Defaults to nil.
  • label (:string) - Defaults to nil.
  • value (:any) - Defaults to nil.
  • min (:any) - Defaults to nil.
  • max (:any) - Defaults to nil.
  • step (:any) - Defaults to 1.
  • variant (:string) - Defaults to "outlined". Must be one of "outlined", or "filled".
  • shape (:atom) - corner radius token, see PhoenixPaper.Shape. Defaults to :sm. Must be one of :none, :xs, :sm, :md, :lg, :xl, or :full.
  • field (Phoenix.HTML.FormField) - Defaults to nil.
  • errors (:list) - Defaults to [].
  • helper_text (:string) - Defaults to nil.
  • disabled (:boolean) - Defaults to false.
  • paperize (:boolean) - Defaults to true.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted. Supports all globals plus: ["autocomplete", "autofocus", "form", "readonly", "required"].