Skip to main content
Mantı UI logoMantı UIv0.12.1
Studio

NumberInput

Use min, max, and step to constrain the value. onValueChange reports the string value and parsed number.

import { NumberInput } from '@manti-ui/react';

export default function NumberInputBasic() {
  return (
    <NumberInput
      label="Servings"
      variant="primary"
      defaultValue="12"
      min={0}
      max={99}
      step={1}
    />
  );
}

Sizes

API

PropTypeDefaultDescription
labelReactNodeOptional field label.
size'sm' | 'md' | 'lg''md'Control size.
variantMantiVariant'primary'Focus-ring variant.
valuestringControlled value, mirroring the input string.
defaultValuestringInitial value for uncontrolled usage.
onValueChange(value: string, valueAsNumber: number) => voidCalled whenever the value changes.
minnumberMinimum allowed value.
maxnumberMaximum allowed value.
stepnumberIncrement/decrement step.
allowMouseWheelbooleanAllow the mouse wheel to change the value while focused.
invalidbooleanMark the field as invalid.
disabledbooleanDisable the control.
readOnlybooleanMake the field read-only.
rootProps / inputPropsHTMLAttributes / InputHTMLAttributesProps for the wrapper and actual numeric input, including ARIA and data attributes.

Styling

Anatomy

PartSelectorDescription
root[data-scope="number-input"][data-part="root"]The field wrapper carrying scope, size, variant, and state.
label[data-scope="number-input"][data-part="label"]Optional label above the control.
control[data-scope="number-input"][data-part="control"]The framed group holding the input and the two triggers.
input[data-scope="number-input"][data-part="input"]The text input that reflects the numeric value.
decrement-trigger[data-scope="number-input"][data-part="decrement-trigger"]Button that steps the value down.
increment-trigger[data-scope="number-input"][data-part="increment-trigger"]Button that steps the value up.

Tokens

TokenControls
--manti-number-input-heightheight
--manti-number-input-stepper-widthstepper width
--manti-number-input-radiusradius

Last updated

Built end-to-end with Manti UI components and design tokens. Manti UI is a framework-agnostic design system on Zag.js.

GitHub