Formify Docs

Max

Enforce a maximum numeric value.

Max

Validates that a numeric value is at most a given maximum. Works with numbers and numeric strings.

Configuration

Config flagTypeDescription
maxnumberMaximum accepted value.
max[number, string]Tuple form — the maximum plus a custom message.

With useForm

const form = useForm({
  initialValues: { guests: '' },
  validationSchema: {
    guests: { max: 10 },
  },
});

With a custom message:

guests: { max: [10, 'No more than 10 guests'] }

With the V builder

import { V } from 'formify-js';

V.max(10);

Default message

ScenarioMessage
Value is above the maximumMust be at most 10 (the number reflects your value)

Examples

ValueRuleResult
'10'max: 10✅ Valid (inclusive)
'10.5'max: 10❌ Invalid
100max: 50❌ Invalid

Notes

  • The check is inclusive: a value of exactly 10 passes max: 10.
  • Non-numeric values fail the comparison — pair with numeric or integer for clearer errors.
  • Use between to constrain both ends at once.

On this page