{"name":"number-input","title":"Number Input","description":"","kind":"component","category":"inputs","status":"beta","props":{"value":{"type":"string","model":true,"description":"The text of the field (\"12\"; \"\" when empty). onValueChange also gives the number."},"min":{"type":"number","description":"Lower bound: the minus button is disabled there, and a typed value below it is clamped on blur."},"max":{"type":"number","description":"Upper bound."},"step":{"type":"number","default":1},"size":{"type":"enum","values":["xs","sm","md","lg"],"default":"md","description":"The Input's sizes (`lib/control.ts`): xs 24px field and 18px buttons, sm 28px and 20px, md 32px and 24px, lg 36px and 24px."},"variant":{"type":"enum","values":["outline","subtle","ghost"],"default":"outline","description":"The shared control's looks (`lib/control.ts`), at every size. outline: the form field (field colour, hairline). subtle: the inspector (inset grey, no edge). ghost: nothing until touched. Focused, open and invalid look the same in every variant."},"label":{"type":"string","description":"Visible label above the field."},"placeholder":{"type":"string"},"formatOptions":{"type":"object","description":"Intl.NumberFormat options for the shown value (style currency / percent, grouping, fraction digits)."},"allowMouseWheel":{"type":"boolean","default":false,"description":"The wheel steps the value while the field has focus."},"decrementLabel":{"type":"string","default":"Decrease","description":"Accessible name of the minus button."},"incrementLabel":{"type":"string","default":"Increase","description":"Accessible name of the plus button."},"invalid":{"type":"boolean","default":false,"description":"The Input's red ring (aria-invalid)."},"disabled":{"type":"boolean","default":false},"readOnly":{"type":"boolean","default":false},"name":{"type":"string","description":"Form field name."}},"playground":{"name":"Playground","props":{"label":"Seats","value":"12","min":1,"max":500,"size":"md","variant":"outline","invalid":false,"disabled":false},"width":160},"exampleFiles":[{"file":"seats","title":"Seats"},{"file":"spend-limit","title":"Monthly spend limit"},{"file":"webhook-retries","title":"Retries in a settings row"},{"file":"seats-total","title":"Seats with a live total"}],"worstCase":[{"name":"Long label","width":160,"props":{"label":"Maximum concurrent background synchronisation jobs per workspace","value":"12480"}},{"name":"Huge value","width":120,"props":{"aria-label":"Amount","value":"123456789012345"}},{"name":"Empty","width":160,"props":{"label":"Seats","placeholder":"None"}},{"name":"Right-to-left label","width":160,"props":{"label":"عدد المقاعد","value":"4"}},{"name":"Negative","width":100,"props":{"size":"sm","aria-label":"Offset","value":"-1","min":-10,"max":10}}],"anatomy":[{"part":"root","element":"div","description":"Ark's number-input root: a column, the label above the control. As wide as its container (give it a width)."},{"part":"label","element":"label","optional":true,"description":"Visible name (the label prop): text.sm, medium, ink, as the Field's label. It wraps, never truncates."},{"part":"control","element":"div","description":"Holds the field and the two buttons laid over its end."},{"part":"input","element":"input","description":"The Input (data-number-input=\"input\"): role=spinbutton, tabular figures, its end padded for the buttons (xs 42px, sm 48px, md 56px, lg 60px)."},{"part":"decrement-trigger","element":"button","description":"The Button (data-number-input=\"decrement-trigger\"): ghost, muted, rounded, square, with a minus; xs 18px, sm 20px, md and lg 24px. Out of the tab order; disabled at the minimum. Held down it repeats. On a coarse pointer its hit area is 40px high."},{"part":"increment-trigger","element":"button","description":"The Button (data-number-input=\"increment-trigger\") with a plus, at the very end: as the decrement trigger; disabled at the maximum."}],"events":{"valueChange":"(value: string, valueAsNumber: number) on every change","valueCommit":"(value: string, valueAsNumber: number) after Enter, a blur or a step"},"states":["hover","focus","invalid","disabled","at-min","at-max"],"tokens":["color.ink","text.sm"],"a11y":{"role":"spinbutton","keyboard":["Arrow Up / Arrow Down: one step up / down; with Shift ten steps","Home / End: the minimum / the maximum (when set)","Enter: settles the typed value (formatted and clamped)","The buttons are out of the tab order: the arrow keys do what they do"],"notes":["The field is role=spinbutton with aria-valuemin, aria-valuemax, aria-valuenow and aria-roledescription \"numberfield\".","Name it with label (visible) or aria-label; the buttons are named by decrementLabel / incrementLabel and point at the field (aria-controls).","The text is 16px on touch devices (the Input's rule), so iOS does not zoom.","To set it from outside, control `value`: React value / onValueChange."]},"motion":["the Input's: rings over duration.base, fill over duration.fast (pointer hover only)","the Buttons': press scales to motion.press-scale; hover fill over duration.fast (pointer only)","the value changes in place, instantly"]}