range
Last updated
Was this helpful?
Last updated
Was this helpful?
The range
validator combines the min
and max
validators to check that a value is within a range. Both the min
and max
values are inclusive.
If the value being validated is null
, false
, an empty string, or another falsy value other than 0
, then the result will be valid. This respects the rule of thumb described in the notes for the validator.
min
: The minimum value compared against
max
: The maximum value compared against
The range
validator supports three parameter signatures:
range(min, max)
where the min
and max
named props are specified as values
range(propsObject)
where the props object contains min
and max
named props
range(propsFunction)
where the props function returns a props object with min
and max
named props