Min
Enforce a minimum numeric value.
Min
Validates that a numeric value is at least a given minimum. Works with numbers and numeric strings.
Configuration
| Config flag | Type | Description |
|---|---|---|
min | number | Minimum accepted value. |
min | [number, string] | Tuple form — the minimum plus a custom message. |
With useForm
const form = useForm({
initialValues: { age: '' },
validationSchema: {
age: { min: 18 },
},
});With a custom message:
age: { min: [18, 'You must be at least 18 years old'] }With the V builder
import { V } from 'formify-js';
V.min(18);Default message
| Scenario | Message |
|---|---|
| Value is below the minimum | Must be at least 18 (the number reflects your value) |
Examples
| Value | Rule | Result |
|---|---|---|
'18' | min: 18 | ✅ Valid (inclusive) |
'17.9' | min: 18 | ❌ Invalid |
-5 | min: 0 | ❌ Invalid |
Notes
- The check is inclusive: a value of exactly
18passesmin: 18. - Non-numeric values fail the comparison — pair with
numericorintegerfor clearer errors. - Use
betweento constrain both ends at once.