anyOf()
Multiple rules targeting the same field are ANDed by default. Wrap them in anyOf() when any one successful path should unlock the target.
Use eitherOf() when those OR paths need names and each path is itself a group of ANDed rules.
Signature
Section titled “Signature”anyOf(ruleA, ruleB, ruleC)All inner rules must target the same fields, or creation throws.
Example
Section titled “Example”anyOf( enabledWhen('submit', ({ password }) => !!password, { reason: 'Enter a password', }), enabledWhen('submit', (_values, conditions) => conditions.bypass === true, { reason: 'Bypass flag missing', }),)Either a password or a bypass flag unlocks submit. When both fail, all inner reasons are collected in reasons.
See also
Section titled “See also”- Quick Start: anyOf — interactive demo
eitherOf()— named OR branches built from rule groupsenabledWhen()— the most common inner rule foranyOf