Formify Docs

Integer

Validate that a value is a whole number without decimals.

Integer

Validates that a value is an integer — a whole number with no decimal or fractional part. Negative integers and zero are accepted.

Configuration

Config flagTypeDescription
integerbooleanWhen true, requires the value to be an integer.

With useForm

const form = useForm({
  initialValues: { quantity: '' },
  validationSchema: {
    quantity: { integer: true },
  },
});

With the V builder

import { V } from 'formify-js';

V.integer();

Default message

ScenarioMessage
Value is not a whole numberMust be an integer

Examples

ValueResult
'42'✅ Valid
'-3'✅ Valid
'0'✅ Valid
'4.5'❌ Invalid
'4.0'❌ Invalid (decimal notation rejected)

Notes

  • Combine with min / max / between to constrain the accepted range.
  • A value like 4.0 fails because the decimal point is present; the check is on the literal value, not Number.isInteger coercion.

On this page