Skip to main content

Overview

reatomFieldArray creates a reactive atom for managing dynamic arrays of form fields. It combines LinkedListAtom with field capabilities, providing:
  • Efficient list operations (add, remove, reorder)
  • Form state tracking (validation, focus, dirty)
  • Support for nested field structures
  • Factory functions for custom field creation

Type Signature

Parameters

Param[] | CreateFunction
Either:
  • Array of initial values (automatically converted to fields)
  • Factory function to create field structure from parameter
FieldArrayOptions<Param, Node> | string
Configuration options or debug name string

Return Value

FieldArrayAtom<Param, Node>
Field array atom with the following properties:

Examples

Basic Array

Array with Factory Function

Array with Initial State and Factory

Array Validation

Custom Validation Logic

Nested Arrays

Complex Nested Structure

Moving Items

Dynamic Reset

Array with Cross-Field Validation

Dirty State Tracking

Async Array Validation

Type Utilities

FieldArrayItem

Extract the type of a single element from a field array:

isFieldArrayAtom

Type guard to check if an atom is a field array: