HEEx
<div class="w-48">
<ConnieUI.Forms.decimal placeholder="0,00" field={@field} />
</div>
Variant matrix
Every combination of one or two attributes, side by side.
Controls
Set by the example
field
Docs
A field for a number that may carry a fraction: an amount, a rate, a
quantity someone measures rather than counts.
Deliberately not `type="number"`. That element may only hold a valid
floating-point number, so a browser given `1200,50` leaves the text on screen,
sets the value to the empty string, and offers no way to read what was typed.
Which separators it accepts depends on the operating system's locale, the
browser's UI language and the element's own `lang` together, so the same
person entering the same amount succeeds on one machine and silently submits
nothing on another. `inputmode="decimal"` asks for the numeric keypad without
handing the element a veto over the value, and where it is not supported the
fallback is an ordinary keyboard rather than a lost number.
No `pattern` either: a regex admitting both separators and grouping in every
locale would raise native constraint validation the host's parser has already
been asked to decide, and two authorities that can disagree is worse than one.
Use `number/1` for a whole count, where the spinner and `step` earn their
keep.
| Attribute | Type | Default | Description |
|---|---|---|---|
| No data found. | |||
| field * | {:struct, Phoenix.HTML.FormField} |
|
|
| size | :string | "sm" |
sm | md
|
| rest | :global |
|
|