disables()
When the source is active, the targets are disabled. Unlike requires(), disables() only checks whether the source value is satisfied — it does not check the source’s own availability.
Signature
Section titled “Signature”disables( source, ['targetA', 'targetB'], { reason?: string | ((values, conditions) => string) },)source can be:
- a field name
- a named field builder
- a predicate
(values, conditions) => boolean - a
check(field, validator)helper
targets can be:
- field names
- named field builders
Examples
Section titled “Examples”// Field-name source — when dates has a value, pattern fields disabledisables('dates', ['everyWeekday', 'everyDate', 'everyMonth'])
// Predicate source — condition-driven disabledisables((_v, c) => c.promoActive, ['serviceLevel', 'vehicleType'], { reason: 'locked by active promotion',})Default reason
Section titled “Default reason”"overridden by <fieldName>"for a field-name source"overridden by condition"for a predicate source without preserved field metadata
Important behavior
Section titled “Important behavior”A disabled field with a lingering value still affects its dependents. disables checks source values, not source availability. This is intentional — a stale value in a disabled source still disables targets until the consumer clears it.
See also
Section titled “See also”- Quick Start: disables — interactive demo
- Availability vs Validation — why stale values persist