lessThan
Validates that a numeric value is less than (or equal to) a maximum.
Options
| Option | Type | Default | Description |
|---|---|---|---|
max | number | required | Maximum allowed value |
inclusive | boolean | true | If true, the maximum value itself is valid |
message | string | locale default | Custom error message |
Playground
Valid values
| Value | Notes |
|---|---|
"100" | Equal to max (inclusive=true) |
"50" | Below max |
Invalid values
| Value | Reason |
|---|---|
"101" | Above max |
"100" | Equal to max when inclusive: false |
"abc" | Not a number |
Notes
- Empty string (
"") always returnsvalid: true— validators only run on non-empty values. Combine withnotEmptyto require a value. - With
inclusive: true(default), the boundary value itself is valid.