You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| ref | No | <code>let</code> | Yes | <code>null | HTMLInputElement</code> | <code>null</code> | Obtain a reference to the input HTML element |
2506
+
| value | No | <code>let</code> | Yes | <code>null | number</code> | <code>null</code> | Specify the input value.<br />Use `null` to denote "no value" |
2507
+
| size | No | <code>let</code> | No | <code>"sm" | "xl"</code> | <code>undefined</code> | Set the size of the input |
2508
+
| step | No | <code>let</code> | No | <code>number</code> | <code>1</code> | Specify the step increment |
2509
+
| max | No | <code>let</code> | No | <code>number</code> | <code>undefined</code> | Specify the maximum value |
2510
+
| min | No | <code>let</code> | No | <code>number</code> | <code>undefined</code> | Specify the minimum value |
2511
+
| light | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to enable the light variant |
2512
+
| readonly | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` for the input to be read-only |
2513
+
| allowEmpty | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to allow for an empty value |
2514
+
| allowDecimal | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to preserve decimal input formatting (e.g., "1.0", "2.00")<br />When enabled, uses type="text" with inputmode="decimal" instead of type="number" |
2515
+
| disabled | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to disable the input |
2516
+
| hideSteppers | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to hide the input stepper buttons |
2517
+
| iconDescription | No | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the ARIA label for the increment icons |
2518
+
| invalid | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to indicate an invalid state |
2519
+
| invalidText | No | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the invalid state text |
2520
+
| warn | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to indicate a warning state |
2521
+
| warnText | No | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the warning state text |
2522
+
| helperText | No | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the helper text |
2523
+
| label | No | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the label text |
2524
+
| hideLabel | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to visually hide the label text |
2525
+
| translateWithId | No | <code>let</code> | No | <code>(id: NumberInputTranslationId) => string</code> | <code>(id) => defaultTranslations[id]</code> | Override the default translation ids |
Copy file name to clipboardExpand all lines: docs/src/COMPONENT_API.json
+12Lines changed: 12 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -9284,6 +9284,18 @@
9284
9284
"constant": false,
9285
9285
"reactive": false
9286
9286
},
9287
+
{
9288
+
"name": "allowDecimal",
9289
+
"kind": "let",
9290
+
"description": "Set to `true` to preserve decimal input formatting (e.g., \"1.0\", \"2.00\")\nWhen enabled, uses type=\"text\" with inputmode=\"decimal\" instead of type=\"number\"",
Copy file name to clipboardExpand all lines: docs/src/pages/components/NumberInput.svx
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,12 @@ Control the increment/decrement step size using the `step` prop. This example us
39
39
40
40
<NumberInput value="{1}" helperText="Step of 0.1" step={0.1} label="Clusters" />
41
41
42
+
## Preserve decimal input
43
+
44
+
Preserve decimal input formatting like "1.0", "2.00", or "3." by setting `allowDecimal` to `true`. This uses `type="text"` with `inputmode="decimal"` instead of `type="number"`, allowing trailing zeros and decimal points to be preserved while typing. This is useful for financial data or precise decimal entry.
0 commit comments