NumberInput
Exact numbers: end-aligned tabular digits, a unit, quiet steppers, a decimal string value.
function Money() {
const [v, setV] = useState("1250.00");
return (
<div className="flex w-280 flex-col gap-8">
<NumberInput label="Monthly budget" value={v} onValueChange={setV} unit="USD" step="50" min="0" />
<span className="mono text-small text-fg-secondary">value = "{v}"</span>
</div>
);
}import { NumberInput } from "@logicplanes/kaeso-ui";Props
align"start" | "end" = endText alignment of the value; numbers align to the end with tabular digits.
defaultValuestringThe number on first render, as text.
descriptionReactNodeOne sentence of help under the label.
errorReactNodeThe error message, shown under the control in the danger color; it marks the control invalid and is read out with its description.
hideStepperbooleanHide the stepper circles, where a value is typed rather than nudged, such as an id or a year.
integerbooleanWhole numbers only, such as a count of days: a numeric keypad on phones and no thousands separators in the field.
invalidbooleanShows it as invalid; pair it with a message that says what to fix.
labelReactNodeThe visible label.
layout"horizontal" | "vertical"The label above the control (
vertical) or beside it (horizontal).leadingIconIconSvgElementAn icon before the text.
maxstringThe highest number allowed.
minstringThe lowest number allowed.
onValueChange((value: string) => void)Called with the number as text, as typed.
optionalbooleanAdds “Optional” to the label, for forms where most fields are required.
prefixReactNodeText before the value: "https://".
size"md" | "sm" | "lg" | "xl"The height of the input.
stepstring = 1Step for the stepper and arrow keys, as a decimal string.
suffixReactNodeText after the value: "USD", "/ min".
trailingReactNodeAny trailing element (a button, a Kbd).
unitstringUnit after the value: "USD", "tokens", "/ min".
valuestringThe exact value as a decimal string ("12.50"). Never a float.