Skip to content

enabledWhen()

Enables a field only when the predicate returns true. The most common rule for condition-driven gating — plan tiers, feature flags, permissions, environment checks.

enabledWhen(
field,
(values, conditions) => boolean,
{
reason?: string | ((values, conditions) => string)
},
)
enabledWhen('companyName', (_values, conditions) => conditions.plan === 'business', {
reason: 'business plan required',
})

"condition not met"