Skip to content

Interface: ArrayNode<Shape> ​

Defined in: core/src/nodes/node-types.ts:322

A node of an array. Errors, touched state and checks belong to items by key, so they move with them.

Extends ​

Type Parameters ​

Type Parameter
Shape

Properties ​

PropertyModifierTypeDescriptionInherited fromDefined in
blurreadonly() => voidMarks the node as touched and starts checks that run on blur.NodeBase.blurcore/src/nodes/node-types.ts:252
clearErrorsreadonly(options?) => voidRemoves external errors in this subtree. Schema and rule errors follow their values.NodeBase.clearErrorscore/src/nodes/node-types.ts:268
errorMessagereadonlystring | undefinedThe node's first visible error as text, from the form's formatError; undefined while none is visible. It is not cached, so a message translated in formatError follows the current language where it is read.NodeBase.errorMessagecore/src/nodes/node-types.ts:243
focusreadonly() => voidFocuses the element with this node's id, through the form's focusElement.NodeBase.focuscore/src/nodes/node-types.ts:271
handleSubmitreadonly(onValid, options?) => () => Promise<SubmitOutcome>Returns a submit function for this node. It skips while a submit runs, validates the subtree as validate does and either shows and focuses its errors and the checks that threw, or calls onValid with the output.NodeBase.handleSubmitcore/src/nodes/node-types.ts:262
idreadonlystringDOM id: the form id and the node's path.NodeBase.idcore/src/nodes/node-types.ts:235
insertreadonly(index, value) => void--core/src/nodes/node-types.ts:327
itemsreadonlyreadonly (NodeOf<ShapeAt<Shape, `${number}`>> & ArrayItem)[]--core/src/nodes/node-types.ts:325
kindreadonlyNodeKind-NodeBase.kindcore/src/nodes/node-types.ts:233
listErrorsreadonly(options?) => readonly ListedError[]-NodeBase.listErrorscore/src/nodes/node-types.ts:269
movereadonly(from, to) => void--core/src/nodes/node-types.ts:329
pathreadonlystringDotted path from the root. Array items appear by their current index.NodeBase.pathcore/src/nodes/node-types.ts:237
pushreadonly(value) => void--core/src/nodes/node-types.ts:326
removereadonly(index) => void--core/src/nodes/node-types.ts:328
replacereadonly(values) => void--core/src/nodes/node-types.ts:331
resetreadonly(options?) => voidReturns the subtree to its initial value, or makes options.value its new initial value.NodeBase.resetcore/src/nodes/node-types.ts:264
setErrorsreadonly(errors, options?) => voidSets external errors with paths relative to this node. They are visible at once.NodeBase.setErrorscore/src/nodes/node-types.ts:266
setValuereadonly(value) => voidWrites a draft value. undefined empties a field and removes its key from the parent's value.NodeBase.setValuecore/src/nodes/node-types.ts:250
statereadonlyNodeState<DraftOf<Shape>>-NodeBase.statecore/src/nodes/node-types.ts:238
subscribereadonly(listener) => () => voidCalls the listener once after a change to this node's state or path, or once per batch. Returns a function that unsubscribes.NodeBase.subscribecore/src/nodes/node-types.ts:248
summaryIdreadonlystringId for an error summary element, focused by a submit with shouldFocusError: 'summary'.-core/src/nodes/node-types.ts:324
swapreadonly(first, second) => void--core/src/nodes/node-types.ts:330
validatereadonly() => Promise<ValidationResult<OutputOf<Shape>>>Validates the subtree, asks its checks again, waiting for any already running, and returns the result without making errors visible.NodeBase.validatecore/src/nodes/node-types.ts:257

Released under the MIT License.