Skip to content

Package @reatom/form

@reatom/form

Interfaces

BaseFormOptions

Defined in: form/reatomForm.ts:174

Extended by

Properties

keepErrorDuringValidating?

optional keepErrorDuringValidating: boolean

Defined in: form/reatomForm.ts:190

Defines the default reset behavior of the validation state during async validation for all fields.

Default
false
keepErrorOnChange?

optional keepErrorOnChange: boolean

Defined in: form/reatomForm.ts:199

Defines the default reset behavior of the validation state on field change for all fields. Useful if the validation is triggered on blur or submit only.

Default
!validateOnChange
name?

optional name: string

Defined in: form/reatomForm.ts:175

resetOnSubmit?

optional resetOnSubmit: boolean

Defined in: form/reatomForm.ts:182

Should reset the state after success submit?

Default
false
validateOnBlur?

optional validateOnBlur: boolean

Defined in: form/reatomForm.ts:215

Defines if the validation should be triggered on the field blur by default for all fields.

Default
false
validateOnChange?

optional validateOnChange: boolean

Defined in: form/reatomForm.ts:207

Defines if the validation should be triggered with every field change by default for all fields.

Default
false

FieldAtom()<State, Value>

Defined in: form/reatomField.ts:103

Base changeable state container.

Atom is the core primitive for storing and updating mutable state in Reatom. It can be called to retrieve its current state or update it with a new value or update function.

Extends

Type Parameters

State

State = any

The type of state stored in the atom

Value

Value = State

FieldAtom(…params): State

Defined in: form/reatomField.ts:103

Base changeable state container.

Atom is the core primitive for storing and updating mutable state in Reatom. It can be called to retrieve its current state or update it with a new value or update function.

Parameters

params

…[]

Parameters to pass to the atom

Returns

State

The atom’s payload (typically its current state)

Properties

__reatom

__reatom: AtomMeta

Defined in: core/atom.ts:106

Reference to the atom’s internal metadata.

Inherited from

FieldLikeAtom.__reatom

__reatomField

__reatomField: true

Defined in: form/reatomField.ts:100

Inherited from

FieldLikeAtom.__reatomField

actions

actions: Actions<FieldAtom<State, Value>>

Defined in: core/atom.ts:86

Bind methods to the atom to extend its functionality.

Deprecated

Use extend instead

Inherited from

FieldLikeAtom.actions

change

change: Action<[Value], Value>

Defined in: form/reatomField.ts:109

Action for handling field changes, accepts the “value” parameter and applies it to toState option.

disabled

disabled: BooleanAtom

Defined in: form/reatomField.ts:127

Atom that defines if the field is disabled

elementRef

elementRef: Atom<undefined | FieldElementRef>

Defined in: form/reatomField.ts:130

Atom with the reference to the field element.

extend

extend: Extend<FieldAtom<State, Value>>

Defined in: core/atom.ts:92

Extension system to add capabilities to atoms. Allows adding middleware, methods, or other functionality to modify atom behavior.

Inherited from

FieldLikeAtom.extend

focus

focus: FocusAtom

Defined in: form/reatomField.ts:112

Atom of an object with all related focus statuses.

initState

initState: Atom<State>

Defined in: form/reatomField.ts:115

The initial state of the atom.

options

options: RecordAtom<{ keepErrorDuringValidating: undefined | boolean; keepErrorOnChange: undefined | boolean; shouldValidate: undefined | boolean; validateOnBlur: undefined | boolean; validateOnChange: undefined | boolean; }>

Defined in: form/reatomField.ts:132

reset

reset: Action<[] | [State], void>

Defined in: form/reatomField.ts:118

Action to reset the state, the value, the validation, and the focus.

subscribe()

subscribe: (cb?) => Unsubscribe

Defined in: core/atom.ts:103

Subscribe to state changes, with the first call happening immediately. When a subscriber is added, the callback is immediately invoked with the current state. After that, it’s called whenever the atom’s state changes.

Parameters
cb?

(state) => any

Callback function that receives the atom’s state when it changes

Returns

Unsubscribe

An unsubscribe function that removes the subscription when called

Inherited from

FieldLikeAtom.subscribe

validation

validation: ValidationAtom

Defined in: form/reatomField.ts:121

Atom of an object with all related validation statuses.

value

value: Atom<Value>

Defined in: form/reatomField.ts:124

Writable atom with the “value” data, computed by the fromState option

Methods

set()
Call Signature

set(update): State

Defined in: core/atom.ts:127

Update the atom’s state using a function that receives the previous state

Parameters
update

(state) => State

Function that takes the current state and returns a new state

Returns

State

The new state value

Inherited from

FieldLikeAtom.set

Call Signature

set(…params): State

Defined in: core/atom.ts:135

Set the atom’s state to a new value

Parameters
params

…[State]

Returns

State

The new state value

Inherited from

FieldLikeAtom.set


FieldElementRef

Defined in: form/reatomField.ts:95

Properties

focus()

focus: (options?) => void

Defined in: form/reatomField.ts:96

Parameters
options?
preventScroll?

boolean

Returns

void


FieldError<Meta>

Defined in: form/reatomField.ts:57

Extends

Extended by

Type Parameters

Meta

Meta = any

Properties

message

message: string

Defined in: form/reatomField.ts:47

The message of the error useful for a user.

Inherited from

FieldErrorBody.message

meta?

optional meta: Rec<Meta>

Defined in: form/reatomField.ts:52

The record with arbitrary information about the error like minimum chars, upper bound of a number, etc.

Inherited from

FieldErrorBody.meta

source

source: FieldErrorSource

Defined in: form/reatomField.ts:62

The type of an error source. The value will be validation if the error occurred due to the validate function.


FieldErrorBody<Meta>

Defined in: form/reatomField.ts:45

Extended by

Type Parameters

Meta

Meta = any

Properties

message

message: string

Defined in: form/reatomField.ts:47

The message of the error useful for a user.

meta?

optional meta: Rec<Meta>

Defined in: form/reatomField.ts:52

The record with arbitrary information about the error like minimum chars, upper bound of a number, etc.


FieldFocus

Defined in: form/reatomField.ts:34

Properties

active

active: boolean

Defined in: form/reatomField.ts:36

The field is focused.

dirty

dirty: boolean

Defined in: form/reatomField.ts:39

The field state is not equal to the initial state.

touched

touched: boolean

Defined in: form/reatomField.ts:42

The field has ever gained and lost focus.


FieldLikeAtom()<State>

Defined in: form/reatomField.ts:99

Base changeable state container.

Atom is the core primitive for storing and updating mutable state in Reatom. It can be called to retrieve its current state or update it with a new value or update function.

Extends

Extended by

Type Parameters

State

State = any

The type of state stored in the atom

FieldLikeAtom(…params): State

Defined in: form/reatomField.ts:99

Base changeable state container.

Atom is the core primitive for storing and updating mutable state in Reatom. It can be called to retrieve its current state or update it with a new value or update function.

Parameters

params

…[]

Parameters to pass to the atom

Returns

State

The atom’s payload (typically its current state)

Properties

__reatom

__reatom: AtomMeta

Defined in: core/atom.ts:106

Reference to the atom’s internal metadata.

Inherited from

Atom.__reatom

__reatomField

__reatomField: true

Defined in: form/reatomField.ts:100

actions

actions: Actions<FieldLikeAtom<State>>

Defined in: core/atom.ts:86

Bind methods to the atom to extend its functionality.

Deprecated

Use extend instead

Inherited from

Atom.actions

extend

extend: Extend<FieldLikeAtom<State>>

Defined in: core/atom.ts:92

Extension system to add capabilities to atoms. Allows adding middleware, methods, or other functionality to modify atom behavior.

Inherited from

Atom.extend

subscribe()

subscribe: (cb?) => Unsubscribe

Defined in: core/atom.ts:103

Subscribe to state changes, with the first call happening immediately. When a subscriber is added, the callback is immediately invoked with the current state. After that, it’s called whenever the atom’s state changes.

Parameters
cb?

(state) => any

Callback function that receives the atom’s state when it changes

Returns

Unsubscribe

An unsubscribe function that removes the subscription when called

Inherited from

Atom.subscribe

Methods

set()
Call Signature

set(update): State

Defined in: core/atom.ts:127

Update the atom’s state using a function that receives the previous state

Parameters
update

(state) => State

Function that takes the current state and returns a new state

Returns

State

The new state value

Inherited from

Atom.set

Call Signature

set(…params): State

Defined in: core/atom.ts:135

Set the atom’s state to a new value

Parameters
params

…[State]

Returns

State

The new state value

Inherited from

Atom.set


FieldOptions<State, Value>

Defined in: form/reatomField.ts:185

Extended by

Type Parameters

State

State = any

Value

Value = State

Properties

disabled?

optional disabled: boolean

Defined in: form/reatomField.ts:223

Defines if the field is disabled by default.

Default
false
elementRef?

optional elementRef: FieldElementRef

Defined in: form/reatomField.ts:226

Defines a default element reference accosiated with the field.

filter()?

optional filter: (newValue, prevValue) => boolean

Defined in: form/reatomField.ts:191

The callback to filter “value” changes (from the ‘change’ action). It should return ‘false’ to skip the update. By default, it always returns true.

Parameters
newValue

Value

prevValue

Value

Returns

boolean

fromState()?

optional fromState: (state, self) => Value

Defined in: form/reatomField.ts:197

The callback to compute the “value” data from the “state” data. By default, it returns the “state” data without any transformations.

Parameters
state

State

self

FieldAtom<State, Value>

Returns

Value

isDirty()?

optional isDirty: (newValue, prevValue) => boolean

Defined in: form/reatomField.ts:203

The callback used to determine whether the “value” has changed. By default, it utilizes isDeepEqual from reatom/utils.

Parameters
newValue

Value

prevValue

Value

Returns

boolean

keepErrorDuringValidating?

optional keepErrorDuringValidating: boolean

Defined in: form/reatomField.ts:233

Defines the reset behavior of the validation state during async validation.

Default
false
keepErrorOnChange?

optional keepErrorOnChange: boolean

Defined in: form/reatomField.ts:241

Defines the reset behavior of the validation state on field change. Useful if the validation is triggered on blur or submit only.

Default
!validateOnChange
name?

optional name: string

Defined in: form/reatomField.ts:206

The name of the field and all related atoms and actions.

toState()?

optional toState: (value, self) => State

Defined in: form/reatomField.ts:213

The callback to transform the “state” data from the “value” data from the change action. By default, it returns the “value” data without any transformations.

Parameters
value

Value

self

FieldAtom<State, Value>

Returns

State

validate?

optional validate: FieldValidateOption<State, Value> | StandardSchemaV1<State, State>

Defined in: form/reatomField.ts:216

The callback to validate the field.

validateOnBlur?

optional validateOnBlur: boolean

Defined in: form/reatomField.ts:255

Defines if the validation should be triggered on the field blur.

Default
false
validateOnChange?

optional validateOnChange: boolean

Defined in: form/reatomField.ts:248

Defines if the validation should be triggered with every field change.

Default
false

FieldSet()<T>

Defined in: form/reatomFieldSet.ts:72

Derived state container.

A computed atom automatically tracks dependencies and recalculates only when those dependencies change. The calculation is performed lazily, only when the computed value is read AND subscribed to.

Extends

Type Parameters

T

T extends FormInitState

The type of derived state

FieldSet(…params): Deatomize

Defined in: form/reatomFieldSet.ts:72

Derived state container.

A computed atom automatically tracks dependencies and recalculates only when those dependencies change. The calculation is performed lazily, only when the computed value is read AND subscribed to.

Parameters

params

…[]

Parameters to pass to the atom

Returns

Deatomize

The atom’s payload (typically its current state)

Properties

__reatom

__reatom: AtomMeta

Defined in: core/atom.ts:106

Reference to the atom’s internal metadata.

Inherited from

ValidationlessFieldSet.__reatom

actions

actions: Actions<FieldSet<T>>

Defined in: core/atom.ts:86

Bind methods to the atom to extend its functionality.

Deprecated

Use extend instead

Inherited from

ValidationlessFieldSet.actions

extend

extend: Extend<FieldSet<T>>

Defined in: core/atom.ts:92

Extension system to add capabilities to atoms. Allows adding middleware, methods, or other functionality to modify atom behavior.

Inherited from

ValidationlessFieldSet.extend

fieldArraysList

fieldArraysList: Computed<FormFieldArrayAtom[]>

Defined in: form/reatomFieldSet.ts:49

Computed list of all the field arrays from the fields tree

Inherited from

ValidationlessFieldSet.fieldArraysList

fields

fields: FormFields<T>

Defined in: form/reatomFieldSet.ts:43

Fields from the init state

Inherited from

ValidationlessFieldSet.fields

fieldsList

fieldsList: Computed<FieldAtom<any, any>[]>

Defined in: form/reatomFieldSet.ts:46

Computed list of all the fields from the fields tree

Inherited from

ValidationlessFieldSet.fieldsList

fieldsState

fieldsState: Computed<Deatomize<FormFields<T>>>

Defined in: form/reatomFieldSet.ts:57

Atom with the state of the fieldset, computed from all the fields in fieldsList

Deprecated

Use target atom instead

Inherited from

ValidationlessFieldSet.fieldsState

focus

focus: Computed<FieldFocus>

Defined in: form/reatomFieldSet.ts:63

Atom with focus state of the fieldset, computed from all the fields in fieldsList

Inherited from

ValidationlessFieldSet.focus

init

init: Action<[DeepPartial<Deatomize<FormFields<T>>, unknown[]>], void>

Defined in: form/reatomFieldSet.ts:66

Action to set initial values for each field or field array in the fieldset

Inherited from

ValidationlessFieldSet.init

reset

reset: Action<[DeepPartial<Deatomize<FormFields<T>>, unknown[]>], void>

Defined in: form/reatomFieldSet.ts:69

Action to reset the state, the value, the validation, and the focus states.

Inherited from

ValidationlessFieldSet.reset

set

set: unknown

Defined in: core/atom.ts:79

Inherited from

ValidationlessFieldSet.set

subscribe()

subscribe: (cb?) => Unsubscribe

Defined in: core/atom.ts:103

Subscribe to state changes, with the first call happening immediately. When a subscriber is added, the callback is immediately invoked with the current state. After that, it’s called whenever the atom’s state changes.

Parameters
cb?

(state) => any

Callback function that receives the atom’s state when it changes

Returns

Unsubscribe

An unsubscribe function that removes the subscription when called

Inherited from

ValidationlessFieldSet.subscribe

validation

validation: Computed<FieldSetValidation> & object

Defined in: form/reatomFieldSet.ts:78

Atom with validation state of the fieldset, computed from all the fields in fieldsList

Type declaration
trigger

trigger: Action<[], FieldSetValidation> & AbortExt

Action to trigger fieldset validation.


FieldSetFieldError

Defined in: form/reatomFieldSet.ts:25

Extends

Properties

field

field: FieldAtom

Defined in: form/reatomFieldSet.ts:26

message

message: string

Defined in: form/reatomField.ts:47

The message of the error useful for a user.

Inherited from

FieldError.message

meta?

optional meta: Rec<any>

Defined in: form/reatomField.ts:52

The record with arbitrary information about the error like minimum chars, upper bound of a number, etc.

Inherited from

FieldError.meta

source

source: FieldErrorSource

Defined in: form/reatomField.ts:62

The type of an error source. The value will be validation if the error occurred due to the validate function.

Inherited from

FieldError.source


FieldSetValidation

Defined in: form/reatomFieldSet.ts:29

Properties

errors

errors: FieldSetFieldError[]

Defined in: form/reatomFieldSet.ts:31

The list of field validation errors.

triggered

triggered: boolean

Defined in: form/reatomFieldSet.ts:34

The validation actuality status.

validating

validating: undefined | Promise<{ errors: FieldSetFieldError[]; }>

Defined in: form/reatomFieldSet.ts:37

The field async validation status


FieldValidation

Defined in: form/reatomField.ts:65

Properties

error

error: undefined | string

Defined in: form/reatomField.ts:67

Message of the first validation error, computed from errors atom

triggered

triggered: boolean

Defined in: form/reatomField.ts:70

The validation actuality status.

validating

validating: undefined | Promise<{ errors: FieldError<any>[]; }>

Defined in: form/reatomField.ts:73

The field async validation status.


FocusAtom()

Defined in: form/reatomField.ts:76

Base atom interface for other userspace implementations. This is the core interface that all atom-like objects implement, providing the foundation for Reatom’s reactivity system.

Extends

FocusAtom(…params): FieldFocus

Defined in: form/reatomField.ts:76

Base atom interface for other userspace implementations. This is the core interface that all atom-like objects implement, providing the foundation for Reatom’s reactivity system.

Parameters

params

any[]

Parameters to pass to the atom

Returns

FieldFocus

The atom’s payload (typically its current state)

Properties

__reatom

__reatom: AtomMeta

Defined in: core/atom.ts:106

Reference to the atom’s internal metadata.

Inherited from

AtomLike.__reatom

actions

actions: Actions<FocusAtom>

Defined in: core/atom.ts:86

Bind methods to the atom to extend its functionality.

Deprecated

Use extend instead

Inherited from

AtomLike.actions

extend

extend: Extend<FocusAtom>

Defined in: core/atom.ts:92

Extension system to add capabilities to atoms. Allows adding middleware, methods, or other functionality to modify atom behavior.

Inherited from

AtomLike.extend

in

in: Action<[], FieldFocus>

Defined in: form/reatomField.ts:78

Action for handling field focus.

out

out: Action<[], FieldFocus>

Defined in: form/reatomField.ts:81

Action for handling field blur.

set

set: unknown

Defined in: core/atom.ts:79

Inherited from

AtomLike.set

subscribe()

subscribe: (cb?) => Unsubscribe

Defined in: core/atom.ts:103

Subscribe to state changes, with the first call happening immediately. When a subscriber is added, the callback is immediately invoked with the current state. After that, it’s called whenever the atom’s state changes.

Parameters
cb?

(state) => any

Callback function that receives the atom’s state when it changes

Returns

Unsubscribe

An unsubscribe function that removes the subscription when called

Inherited from

AtomLike.subscribe


Form()<T, SchemaState, SubmitReturn, SubmitParams>

Defined in: form/reatomForm.ts:133

Derived state container.

A computed atom automatically tracks dependencies and recalculates only when those dependencies change. The calculation is performed lazily, only when the computed value is read AND subscribed to.

Extends

Type Parameters

T

T extends FormInitState = FormInitState

The type of derived state

SchemaState

SchemaState = any

SubmitReturn

SubmitReturn = void

SubmitParams

SubmitParams extends any[] = []

Form(…params): Deatomize

Defined in: form/reatomForm.ts:133

Derived state container.

A computed atom automatically tracks dependencies and recalculates only when those dependencies change. The calculation is performed lazily, only when the computed value is read AND subscribed to.

Parameters

params

…[]

Parameters to pass to the atom

Returns

Deatomize

The atom’s payload (typically its current state)

Properties

__reatom

__reatom: AtomMeta

Defined in: core/atom.ts:106

Reference to the atom’s internal metadata.

Inherited from

ValidationlessFieldSet.__reatom

actions

actions: Actions<Form<T, SchemaState, SubmitReturn, SubmitParams>>

Defined in: core/atom.ts:86

Bind methods to the atom to extend its functionality.

Deprecated

Use extend instead

Inherited from

ValidationlessFieldSet.actions

extend

extend: Extend<Form<T, SchemaState, SubmitReturn, SubmitParams>>

Defined in: core/atom.ts:92

Extension system to add capabilities to atoms. Allows adding middleware, methods, or other functionality to modify atom behavior.

Inherited from

ValidationlessFieldSet.extend

fieldArraysList

fieldArraysList: Computed<FormFieldArrayAtom[]>

Defined in: form/reatomFieldSet.ts:49

Computed list of all the field arrays from the fields tree

Inherited from

ValidationlessFieldSet.fieldArraysList

fields

fields: FormFields<T>

Defined in: form/reatomFieldSet.ts:43

Fields from the init state

Inherited from

ValidationlessFieldSet.fields

fieldsList

fieldsList: Computed<FieldAtom<any, any>[]>

Defined in: form/reatomFieldSet.ts:46

Computed list of all the fields from the fields tree

Inherited from

ValidationlessFieldSet.fieldsList

fieldsState

fieldsState: Computed<Deatomize<FormFields<T>>>

Defined in: form/reatomFieldSet.ts:57

Atom with the state of the fieldset, computed from all the fields in fieldsList

Deprecated

Use target atom instead

Inherited from

ValidationlessFieldSet.fieldsState

focus

focus: Computed<FieldFocus>

Defined in: form/reatomFieldSet.ts:63

Atom with focus state of the fieldset, computed from all the fields in fieldsList

Inherited from

ValidationlessFieldSet.focus

init

init: Action<[DeepPartial<Deatomize<FormFields<T>>, unknown[]>], void>

Defined in: form/reatomFieldSet.ts:66

Action to set initial values for each field or field array in the fieldset

Inherited from

ValidationlessFieldSet.init

reset

reset: Action<[DeepPartial<Deatomize<FormFields<T>>, unknown[]>], void>

Defined in: form/reatomFieldSet.ts:69

Action to reset the state, the value, the validation, and the focus states.

Inherited from

ValidationlessFieldSet.reset

set

set: unknown

Defined in: core/atom.ts:79

Inherited from

ValidationlessFieldSet.set

submit

submit: SubmitAction<SubmitReturn, SubmitParams>

Defined in: form/reatomForm.ts:168

Submit async handler. It checks the validation of all the fields in fieldsList, calls the form’s validate options handler, and then the onSubmit options handler. Check the additional options properties of async action: https://reatom.dev/handbook/async/.

submitted

submitted: Computed<boolean>

Defined in: form/reatomForm.ts:171

Atom with submitted state of the form

subscribe()

subscribe: (cb?) => Unsubscribe

Defined in: core/atom.ts:103

Subscribe to state changes, with the first call happening immediately. When a subscriber is added, the callback is immediately invoked with the current state. After that, it’s called whenever the atom’s state changes.

Parameters
cb?

(state) => any

Callback function that receives the atom’s state when it changes

Returns

Unsubscribe

An unsubscribe function that removes the subscription when called

Inherited from

ValidationlessFieldSet.subscribe

validation

validation: Computed<FieldSetValidation> & object & undefined extends SchemaState ? object : object

Defined in: form/reatomForm.ts:143

Atom with validation state of the form, computed from all the fields in fieldsList

Type declaration
trigger

trigger: Action<[], Promise<undefined extends SchemaState ? Deatomize<FormFields<T>> : SchemaState>> & AsyncExt<[], any, undefined | Error> & AbortExt

Action to trigger form validation.


FormFieldOptions<State, Value>

Defined in: form/reatomForm.ts:46

Extends

Type Parameters

State

State = any

Value

Value = State

Properties

disabled?

optional disabled: boolean

Defined in: form/reatomField.ts:223

Defines if the field is disabled by default.

Default
false
Inherited from

FieldOptions.disabled

elementRef?

optional elementRef: FieldElementRef

Defined in: form/reatomField.ts:226

Defines a default element reference accosiated with the field.

Inherited from

FieldOptions.elementRef

filter()?

optional filter: (newValue, prevValue) => boolean

Defined in: form/reatomField.ts:191

The callback to filter “value” changes (from the ‘change’ action). It should return ‘false’ to skip the update. By default, it always returns true.

Parameters
newValue

Value

prevValue

Value

Returns

boolean

Inherited from

FieldOptions.filter

fromState()?

optional fromState: (state, self) => Value

Defined in: form/reatomField.ts:197

The callback to compute the “value” data from the “state” data. By default, it returns the “state” data without any transformations.

Parameters
state

State

self

FieldAtom<State, Value>

Returns

Value

Inherited from

FieldOptions.fromState

initState

initState: State

Defined in: form/reatomForm.ts:48

isDirty()?

optional isDirty: (newValue, prevValue) => boolean

Defined in: form/reatomField.ts:203

The callback used to determine whether the “value” has changed. By default, it utilizes isDeepEqual from reatom/utils.

Parameters
newValue

Value

prevValue

Value

Returns

boolean

Inherited from

FieldOptions.isDirty

keepErrorDuringValidating?

optional keepErrorDuringValidating: boolean

Defined in: form/reatomField.ts:233

Defines the reset behavior of the validation state during async validation.

Default
false
Inherited from

FieldOptions.keepErrorDuringValidating

keepErrorOnChange?

optional keepErrorOnChange: boolean

Defined in: form/reatomField.ts:241

Defines the reset behavior of the validation state on field change. Useful if the validation is triggered on blur or submit only.

Default
!validateOnChange
Inherited from

FieldOptions.keepErrorOnChange

name?

optional name: string

Defined in: form/reatomField.ts:206

The name of the field and all related atoms and actions.

Inherited from

FieldOptions.name

toState()?

optional toState: (value, self) => State

Defined in: form/reatomField.ts:213

The callback to transform the “state” data from the “value” data from the change action. By default, it returns the “value” data without any transformations.

Parameters
value

Value

self

FieldAtom<State, Value>

Returns

State

Inherited from

FieldOptions.toState

validate?

optional validate: FieldValidateOption<State, Value> | StandardSchemaV1<State, State>

Defined in: form/reatomField.ts:216

The callback to validate the field.

Inherited from

FieldOptions.validate

validateOnBlur?

optional validateOnBlur: boolean

Defined in: form/reatomField.ts:255

Defines if the validation should be triggered on the field blur.

Default
false
Inherited from

FieldOptions.validateOnBlur

validateOnChange?

optional validateOnChange: boolean

Defined in: form/reatomField.ts:248

Defines if the validation should be triggered with every field change.

Default
false
Inherited from

FieldOptions.validateOnChange


FormOptionsWithoutSchema<T, SubmitReturn, SubmitParams>

Defined in: form/reatomForm.ts:250

Extends

Type Parameters

T

T extends FormInitState

SubmitReturn

SubmitReturn

SubmitParams

SubmitParams extends any[]

Properties

keepErrorDuringValidating?

optional keepErrorDuringValidating: boolean

Defined in: form/reatomForm.ts:190

Defines the default reset behavior of the validation state during async validation for all fields.

Default
false
Inherited from

BaseFormOptions.keepErrorDuringValidating

keepErrorOnChange?

optional keepErrorOnChange: boolean

Defined in: form/reatomForm.ts:199

Defines the default reset behavior of the validation state on field change for all fields. Useful if the validation is triggered on blur or submit only.

Default
!validateOnChange
Inherited from

BaseFormOptions.keepErrorOnChange

name?

optional name: string

Defined in: form/reatomForm.ts:175

Inherited from

BaseFormOptions.name

onSubmit()?

optional onSubmit: (state, …params) => SubmitReturn | Promise<SubmitReturn>

Defined in: form/reatomForm.ts:259

The callback to process valid form data, typed according to the raw form state

Parameters
state

Deatomize<FormFields<T>>

params

SubmitParams

Returns

SubmitReturn | Promise<SubmitReturn>

resetOnSubmit?

optional resetOnSubmit: boolean

Defined in: form/reatomForm.ts:182

Should reset the state after success submit?

Default
false
Inherited from

BaseFormOptions.resetOnSubmit

schema?

optional schema: undefined

Defined in: form/reatomForm.ts:279

Schema is explicitly disallowed or undefined in this variant

validate()?

optional validate: (state) => any

Defined in: form/reatomForm.ts:270

The callback to validate form fields before submit, typed according to the raw form state

Parameters
state

Deatomize<FormFields<T>>

Returns

any

Deprecated

Renamed to validateBeforeSubmit

validateBeforeSubmit()?

optional validateBeforeSubmit: (state) => any

Defined in: form/reatomForm.ts:276

The callback to validate form fields before submit, typed according to the raw form state

Parameters
state

Deatomize<FormFields<T>>

Returns

any

validateOnBlur?

optional validateOnBlur: boolean

Defined in: form/reatomForm.ts:215

Defines if the validation should be triggered on the field blur by default for all fields.

Default
false
Inherited from

BaseFormOptions.validateOnBlur

validateOnChange?

optional validateOnChange: boolean

Defined in: form/reatomForm.ts:207

Defines if the validation should be triggered with every field change by default for all fields.

Default
false
Inherited from

BaseFormOptions.validateOnChange


FormOptionsWithSchema<State, SubmitReturn, SubmitParams>

Defined in: form/reatomForm.ts:218

Extends

Type Parameters

State

State

SubmitReturn

SubmitReturn

SubmitParams

SubmitParams extends any[]

Properties

keepErrorDuringValidating?

optional keepErrorDuringValidating: boolean

Defined in: form/reatomForm.ts:190

Defines the default reset behavior of the validation state during async validation for all fields.

Default
false
Inherited from

BaseFormOptions.keepErrorDuringValidating

keepErrorOnChange?

optional keepErrorOnChange: boolean

Defined in: form/reatomForm.ts:199

Defines the default reset behavior of the validation state on field change for all fields. Useful if the validation is triggered on blur or submit only.

Default
!validateOnChange
Inherited from

BaseFormOptions.keepErrorOnChange

name?

optional name: string

Defined in: form/reatomForm.ts:175

Inherited from

BaseFormOptions.name

onSubmit()?

optional onSubmit: (state, …params) => SubmitReturn | Promise<SubmitReturn>

Defined in: form/reatomForm.ts:224

The callback to process valid form data, typed according to the schema

Parameters
state

State

params

SubmitParams

Returns

SubmitReturn | Promise<SubmitReturn>

resetOnSubmit?

optional resetOnSubmit: boolean

Defined in: form/reatomForm.ts:182

Should reset the state after success submit?

Default
false
Inherited from

BaseFormOptions.resetOnSubmit

schema

schema: StandardSchemaV1<unknown, State>

Defined in: form/reatomForm.ts:247

The schema which supports StandardSchemaV1 specification to validate form fields.

validate()?

optional validate: (state) => any

Defined in: form/reatomForm.ts:235

The callback to validate form fields before submit, typed according to the schema

Parameters
state

State

Returns

any

Deprecated

Renamed to validateBeforeSubmit

validateBeforeSubmit()?

optional validateBeforeSubmit: (state) => any

Defined in: form/reatomForm.ts:241

The callback to validate form fields before submit, typed according to the schema

Parameters
state

State

Returns

any

validateOnBlur?

optional validateOnBlur: boolean

Defined in: form/reatomForm.ts:215

Defines if the validation should be triggered on the field blur by default for all fields.

Default
false
Inherited from

BaseFormOptions.validateOnBlur

validateOnChange?

optional validateOnChange: boolean

Defined in: form/reatomForm.ts:207

Defines if the validation should be triggered with every field change by default for all fields.

Default
false
Inherited from

BaseFormOptions.validateOnChange


ValidationAtom()

Defined in: form/reatomField.ts:84

Base atom interface for other userspace implementations. This is the core interface that all atom-like objects implement, providing the foundation for Reatom’s reactivity system.

Extends

ValidationAtom(…params): FieldValidation

Defined in: form/reatomField.ts:84

Base atom interface for other userspace implementations. This is the core interface that all atom-like objects implement, providing the foundation for Reatom’s reactivity system.

Parameters

params

any[]

Parameters to pass to the atom

Returns

FieldValidation

The atom’s payload (typically its current state)

Properties

__reatom

__reatom: AtomMeta

Defined in: core/atom.ts:106

Reference to the atom’s internal metadata.

Inherited from

AtomLike.__reatom

actions

actions: Actions<ValidationAtom>

Defined in: core/atom.ts:86

Bind methods to the atom to extend its functionality.

Deprecated

Use extend instead

Inherited from

AtomLike.actions

clearErrors

clearErrors: Action<FieldErrorSource[], FieldValidation>

Defined in: form/reatomField.ts:92

Action to clear all errors by passed sources.

errors

errors: ArrayAtom<FieldError<any>>

Defined in: form/reatomField.ts:89

Full list of all errors related to the field

extend

extend: Extend<ValidationAtom>

Defined in: core/atom.ts:92

Extension system to add capabilities to atoms. Allows adding middleware, methods, or other functionality to modify atom behavior.

Inherited from

AtomLike.extend

set

set: unknown

Defined in: core/atom.ts:79

Inherited from

AtomLike.set

subscribe()

subscribe: (cb?) => Unsubscribe

Defined in: core/atom.ts:103

Subscribe to state changes, with the first call happening immediately. When a subscriber is added, the callback is immediately invoked with the current state. After that, it’s called whenever the atom’s state changes.

Parameters
cb?

(state) => any

Callback function that receives the atom’s state when it changes

Returns

Unsubscribe

An unsubscribe function that removes the subscription when called

Inherited from

AtomLike.subscribe

trigger

trigger: Action<[], FieldValidation> & AbortExt

Defined in: form/reatomField.ts:86

Action to trigger field validation.


ValidationlessFieldSet()<T>

Defined in: form/reatomFieldSet.ts:40

Derived state container.

A computed atom automatically tracks dependencies and recalculates only when those dependencies change. The calculation is performed lazily, only when the computed value is read AND subscribed to.

Extends

Extended by

Type Parameters

T

T extends FormInitState

The type of derived state

ValidationlessFieldSet(…params): Deatomize

Defined in: form/reatomFieldSet.ts:40

Derived state container.

A computed atom automatically tracks dependencies and recalculates only when those dependencies change. The calculation is performed lazily, only when the computed value is read AND subscribed to.

Parameters

params

…[]

Parameters to pass to the atom

Returns

Deatomize

The atom’s payload (typically its current state)

Properties

__reatom

__reatom: AtomMeta

Defined in: core/atom.ts:106

Reference to the atom’s internal metadata.

Inherited from

Computed.__reatom

actions

actions: Actions<ValidationlessFieldSet<T>>

Defined in: core/atom.ts:86

Bind methods to the atom to extend its functionality.

Deprecated

Use extend instead

Inherited from

Computed.actions

extend

extend: Extend<ValidationlessFieldSet<T>>

Defined in: core/atom.ts:92

Extension system to add capabilities to atoms. Allows adding middleware, methods, or other functionality to modify atom behavior.

Inherited from

Computed.extend

fieldArraysList

fieldArraysList: Computed<FormFieldArrayAtom[]>

Defined in: form/reatomFieldSet.ts:49

Computed list of all the field arrays from the fields tree

fields

fields: FormFields<T>

Defined in: form/reatomFieldSet.ts:43

Fields from the init state

fieldsList

fieldsList: Computed<FieldAtom<any, any>[]>

Defined in: form/reatomFieldSet.ts:46

Computed list of all the fields from the fields tree

fieldsState

fieldsState: Computed<Deatomize<FormFields<T>>>

Defined in: form/reatomFieldSet.ts:57

Atom with the state of the fieldset, computed from all the fields in fieldsList

Deprecated

Use target atom instead

focus

focus: Computed<FieldFocus>

Defined in: form/reatomFieldSet.ts:63

Atom with focus state of the fieldset, computed from all the fields in fieldsList

init

init: Action<[DeepPartial<Deatomize<FormFields<T>>, unknown[]>], void>

Defined in: form/reatomFieldSet.ts:66

Action to set initial values for each field or field array in the fieldset

reset

reset: Action<[DeepPartial<Deatomize<FormFields<T>>, unknown[]>], void>

Defined in: form/reatomFieldSet.ts:69

Action to reset the state, the value, the validation, and the focus states.

set

set: unknown

Defined in: core/atom.ts:79

Inherited from

Computed.set

subscribe()

subscribe: (cb?) => Unsubscribe

Defined in: core/atom.ts:103

Subscribe to state changes, with the first call happening immediately. When a subscriber is added, the callback is immediately invoked with the current state. After that, it’s called whenever the atom’s state changes.

Parameters
cb?

(state) => any

Callback function that receives the atom’s state when it changes

Returns

Unsubscribe

An unsubscribe function that removes the subscription when called

Inherited from

Computed.subscribe

Type Aliases

ArrayFieldItem<T>

ArrayFieldItem<T> = T extends LinkedListLikeAtom<infer _Node> ? AtomState<T["array"]>[number] : never

Defined in: form/reatomForm.ts:419

Type Parameters

T

T


DeepPartial<T, Skip>

DeepPartial<T, Skip> = { [K in keyof T]?: T[K] extends Skip ? T[K] : T[K] extends Rec ? DeepPartial<T[K], Skip> : T[K] }

Defined in: form/reatomForm.ts:117

Type Parameters

T

T

Skip

Skip = never


FieldErrorSource

FieldErrorSource = "validation" | string & object

Defined in: form/reatomField.ts:55


FieldValidateOption()<State, Value>

FieldValidateOption<State, Value> = (meta) => FieldValidateOptionResult<State> | Promise<FieldValidateOptionResult<State>>

Defined in: form/reatomField.ts:167

Type Parameters

State

State = any

Value

Value = State

Parameters

meta
focus

FieldFocus

state

State

validation

FieldValidation

value

Value

Returns

FieldValidateOptionResult<State> | Promise<FieldValidateOptionResult<State>>


FieldValidateOptionResult<State>

FieldValidateOptionResult<State> = string | string[] | FieldErrorBody | FieldErrorBody[] | StandardSchemaV1<State> | void | undefined

Defined in: form/reatomField.ts:176

Type Parameters

State

State = any


FormFieldArrayAtom<Param, Node>

FormFieldArrayAtom<Param, Node> = LinkedListAtom<[ExtractFieldArray<Param>], FormFieldElement<Node>> & object

Defined in: form/reatomForm.ts:77

Type declaration

initState

initState: Atom<LinkedList<LLNode<FormFieldElement<Node>>>>

reset

reset: Action<[], AtomState<FormFieldArrayAtom<Param, Node>>>

Type Parameters

Param

Param = any

Node

Node extends FormInitStateElement = FormInitStateElement


FormFieldElement<T>

FormFieldElement<T> = T extends FieldLikeAtom ? T : T extends Date ? FieldAtom<T> : T extends infer Item[] ? Item extends FormInitStateElement ? FormFieldArrayAtom<Item, Item> : never : T extends FormFieldArray<infer Param, infer Node> ? FormFieldArrayAtom<Param, Node> : T extends FieldOptions & object ? T extends FieldOptions<State, State> ? FieldAtom<State> : T extends FieldOptions<State, infer Value> ? FieldAtom<State, Value> : object extends T ? FieldAtom<State, State> : never : T extends Rec<unknown> ? { [K in keyof T]: FormFieldElement<T[K]> } : FieldAtom<T>

Defined in: form/reatomForm.ts:85

Type Parameters

T

T extends FormInitStateElement | unknown = FormInitStateElement


FormFields<T>

FormFields<T> = { [K in keyof T]: FormFieldElement<T[K]> }

Defined in: form/reatomForm.ts:109

Type Parameters

T

T extends FormInitState = FormInitState


FormInitState

FormInitState = object

Defined in: form/reatomForm.ts:67

Index Signature

[key: string]: FormInitStateElement | FormInitState


FormPartialState<T>

FormPartialState<T> = DeepPartial<FormState<T>, unknown[]>

Defined in: form/reatomForm.ts:124

Type Parameters

T

T extends FormInitState = FormInitState


FormState<T>

FormState<T> = Deatomize<FormFields<T>>

Defined in: form/reatomForm.ts:113

Type Parameters

T

T extends FormInitState = FormInitState


SubmitAction<Return, Params>

SubmitAction<Return, Params> = Action<Params, Promise<Return>> & AsyncDataExt<Params, Return, Return | undefined, Error | undefined>

Defined in: form/reatomForm.ts:127

Type Parameters

Return

Return

Params

Params extends any[]

Variables

fieldInitFocus

const fieldInitFocus: FieldFocus

Defined in: form/reatomField.ts:258


fieldInitValidation

const fieldInitValidation: FieldValidation

Defined in: form/reatomField.ts:264


fieldInitValidationLess

const fieldInitValidationLess: FieldValidation

Defined in: form/reatomField.ts:270

Functions

experimental_fieldArray()

Call Signature

experimental_fieldArray<Param>(initState): FormFieldArray<Param, Param>

Defined in: form/reatomForm.ts:369

Type Parameters
Param

Param extends FormInitStateElement

Parameters
initState

Param[]

Returns

FormFieldArray<Param, Param>

Call Signature

experimental_fieldArray<Param, Node>(create): FormFieldArray<Param, Node>

Defined in: form/reatomForm.ts:373

Type Parameters
Param

Param

Node

Node extends FormInitStateElement = FormInitStateElement

Parameters
create

(params, name) => Node

Returns

FormFieldArray<Param, Node>

Call Signature

experimental_fieldArray<Param, Node>(options): FormFieldArray<Param, Node>

Defined in: form/reatomForm.ts:378

Type Parameters
Param

Param

Node

Node extends FormInitStateElement = FormInitStateElement

Parameters
options
create

(param, name) => Node

initState?

Param[]

Returns

FormFieldArray<Param, Node>


isFieldAtom()

isFieldAtom(thing): thing is FieldLikeAtom<any>

Defined in: form/reatomField.ts:641

Parameters

thing

any

Returns

thing is FieldLikeAtom<any>


reatomField()

Call Signature

reatomField<State>(_initState, options?): FieldAtom<State, State>

Defined in: form/reatomField.ts:276

Type Parameters
State

State

Parameters
_initState

State

options?

string | FieldOptions<State, State>

Returns

FieldAtom<State, State>

Call Signature

reatomField<State, Value>(_initState, options?): FieldAtom<State, Value>

Defined in: form/reatomField.ts:281

Type Parameters
State

State

Value

Value

Parameters
_initState

State

options?

string | FieldOptions<State, Value>

Returns

FieldAtom<State, Value>

Call Signature

reatomField<State, A, Value>(_initState, options, stateAtom): A & FieldAtom<State, Value>

Defined in: form/reatomField.ts:286

Type Parameters
State

State

A

A extends Atom<State, [State]>

Value

Value = State

Parameters
_initState

State

options

string | FieldOptions<State, Value>

stateAtom

A

Returns

A & FieldAtom<State, Value>


reatomFieldSet()

reatomFieldSet<T>(fields, name): FieldSet<T>

Defined in: form/reatomFieldSet.ts:84

Type Parameters

T

T extends FormInitState

Parameters

fields

FormFields<T>

name

string = ...

Returns

FieldSet<T>


reatomForm()

Call Signature

reatomForm<T, SchemaState, SubmitReturn, SubmitParams>(initState, optionsWithSchema): Form<T, SchemaState, SubmitReturn, SubmitParams>

Defined in: form/reatomForm.ts:452

Type Parameters
T

T extends FormInitState

SchemaState

SchemaState

SubmitReturn

SubmitReturn

SubmitParams

SubmitParams extends any[]

Parameters
initState

T | (name) => T

optionsWithSchema

FormOptionsWithSchema<SchemaState, SubmitReturn, SubmitParams>

Returns

Form<T, SchemaState, SubmitReturn, SubmitParams>

Call Signature

reatomForm<T, SubmitReturn, SubmitParams>(initState, options?): Form<T, undefined, SubmitReturn, SubmitParams>

Defined in: form/reatomForm.ts:466

Type Parameters
T

T extends FormInitState

SubmitReturn

SubmitReturn

SubmitParams

SubmitParams extends any[]

Parameters
initState

T | (name) => T

options?

FormOptionsWithoutSchema<T, SubmitReturn, SubmitParams>

Returns

Form<T, undefined, SubmitReturn, SubmitParams>

Call Signature

reatomForm<T>(initState, name?): Form<T, undefined, void, []>

Defined in: form/reatomForm.ts:475

Type Parameters
T

T extends FormInitState

Parameters
initState

T | (name) => T

name?

string

Returns

Form<T, undefined, void, []>


withField()

Call Signature

withField<T>(options?): (anAtom) => T & FieldAtom<AtomState<T>, AtomState<T>>

Defined in: form/reatomField.ts:626

Type Parameters
T

T extends Atom<any, [any]>

Parameters
options?

Omit<FieldOptions<AtomState<T>, AtomState<T>>, "name">

Returns

(anAtom): T & FieldAtom<AtomState<T>, AtomState<T>>

Parameters
anAtom

T

Returns

T & FieldAtom<AtomState<T>, AtomState<T>>

Call Signature

withField<T, Value>(options?): (anAtom) => T & FieldAtom<AtomState<T>, Value>

Defined in: form/reatomField.ts:630

Type Parameters
T

T extends Atom<any, [any]>

Value

Value

Parameters
options?

Omit<FieldOptions<AtomState<T>, Value>, "name">

Returns

(anAtom): T & FieldAtom<AtomState<T>, Value>

Parameters
anAtom

T

Returns

T & FieldAtom<AtomState<T>, Value>