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