Hero Hook Form API / FieldArrayConfig
Interface: FieldArrayConfig<TFieldValues>
Defined in: types.ts:303
Field array config for dynamic repeating field groups.
Description
Configuration for field arrays that support reordering, custom rendering, default values, and conditional fields within array items.
Extends
Omit<BaseFormFieldConfig<TFieldValues>,"name">
Type Parameters
TFieldValues
TFieldValues extends FieldValues
The form data type
Properties
label?
optionallabel:string
Defined in: types.ts:139
Inherited from
description?
optionaldescription:string
Defined in: types.ts:140
Inherited from
StringArrayFieldConfig.description
className?
optionalclassName:string
Defined in: types.ts:141
Inherited from
DynamicSectionConfig.className
isDisabled?
optionalisDisabled:boolean
Defined in: types.ts:142
Inherited from
DynamicSectionConfig.isDisabled
rules?
optionalrules:RegisterOptions<TFieldValues,Path<TFieldValues>>
Defined in: types.ts:143
Inherited from
Omit.rules
condition()?
optionalcondition: (values) =>boolean
Defined in: types.ts:146
Parameters
values
Partial<TFieldValues>
Returns
boolean
Inherited from
Omit.condition
dependsOn?
optionaldependsOn:Path<TFieldValues>
Defined in: types.ts:147
Inherited from
Omit.dependsOn
dependsOnValue?
optionaldependsOnValue:unknown
Defined in: types.ts:148
Inherited from
DynamicSectionConfig.dependsOnValue
group?
optionalgroup:string
Defined in: types.ts:151
Inherited from
ariaLabel?
optionalariaLabel:string
Defined in: types.ts:154
Inherited from
DynamicSectionConfig.ariaLabel
ariaDescribedBy?
optionalariaDescribedBy:string
Defined in: types.ts:155
Inherited from
DynamicSectionConfig.ariaDescribedBy
type
type:
"fieldArray"
Defined in: types.ts:305
name
name:
ArrayPath<TFieldValues>
Defined in: types.ts:307
Field array name - must be an ArrayPath (points to an array field)
fields
fields:
ZodFormFieldConfig<TFieldValues>[]
Defined in: types.ts:309
Field configurations for each array item
min?
optionalmin:number
Defined in: types.ts:311
Minimum number of items (default: 0)
max?
optionalmax:number
Defined in: types.ts:313
Maximum number of items (default: 10)
addButtonText?
optionaladdButtonText:string
Defined in: types.ts:315
Add button text (default: “Add Item”)
removeButtonText?
optionalremoveButtonText:string
Defined in: types.ts:317
Remove button text (default: “Remove”)
enableReordering?
optionalenableReordering:boolean
Defined in: types.ts:319
Enable reordering of array items with up/down buttons (default: false)
reorderButtonText?
optionalreorderButtonText:object
Defined in: types.ts:321
Custom text for reorder buttons
up?
optionalup:string
Text for move up button (default: ”↑“)
down?
optionaldown:string
Text for move down button (default: ”↓“)
defaultItem()?
optionaldefaultItem: () =>any
Defined in: types.ts:328
Function to create default item when adding new array item
Returns
any
readOnly?
optionalreadOnly:boolean
Defined in: types.ts:330
When true, hide add button, remove buttons, and reorder buttons (display-only)
alwaysRegistered?
optionalalwaysRegistered:boolean
Defined in: types.ts:332
Whether this field array should always be registered (for conditional rendering)
renderItem()?
optionalrenderItem: (props) =>ReactNode
Defined in: types.ts:334
Custom render function for array items
Parameters
props
index
number
Item index (0-based)
field
{[key: string]: any; id: string; }
Field array item with id
field.id
string
fields
object[]
All fields in the array
children
ReactNode
Rendered field elements
onRemove
() => void
Remove this item
onMoveUp
() => void
Move item up
onMoveDown
() => void
Move item down
canRemove
boolean
Whether item can be removed
canMoveUp
boolean
Whether item can move up
canMoveDown
boolean
Whether item can move down
Returns
ReactNode
renderAddButton()?
optionalrenderAddButton: (props) =>ReactNode
Defined in: types.ts:357
Custom render function for add button
Parameters
props
onAdd
() => void
Add new item
canAdd
boolean
Whether new item can be added
Returns
ReactNode