Skip to content

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.

anyOf(ruleA, ruleB, ruleC)

All inner rules must target the same fields, or creation throws.

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.