disabled
function
stablesince v22.0
Adds logic to a field to conditionally disable it. A disabled field does not contribute to the validation, touched/dirty, or other state of its parent field.
API
function disabled<TValue, TPathKind extends PathKind = PathKind.Root>(
path: SchemaPath<TValue, 1, TPathKind>,
config?:
| {
when?:
| string
| NoInfer<LogicFn<TValue, string | boolean, TPathKind>>
| undefined;
}
| undefined,
): void;
function disabled<TValue, TPathKind extends PathKind = PathKind.Root>(
path: SchemaPath<TValue, 1, TPathKind>,
logic?:
| string
| NoInfer<LogicFn<TValue, string | boolean, TPathKind>>
| undefined,
): void;function disabled<TValue, TPathKind = PathKind.Root>(path: SchemaPath<TValue, 1, TPathKind>, config?: { when?: string | NoInfer<LogicFn<TValue, string | boolean, TPathKind>> | undefined; } | undefined): void;Adds logic to a field to conditionally disable it. A disabled field does not contribute to the validation, touched/dirty, or other state of its parent field.
@paramconfig
{ when?: string | NoInfer<LogicFn<TValue, string | boolean, TPathKind>> | undefined; } | undefinedOptional configuration object.
when: A reactive function that returnstrue(or a string reason) when the field is disabled, andfalsewhen it is not disabled. Can also be a static string reason.
@returns
voidfunction disabled<TValue, TPathKind = PathKind.Root>(path: SchemaPath<TValue, 1, TPathKind>, logic?: string | NoInfer<LogicFn<TValue, string | boolean, TPathKind>> | undefined): void;Adds logic to a field to conditionally disable it.
@returns
voidJump to details