Skip to Content
ContentAPIClassesClass: AdvancedFieldBuilder<T>

Hero Hook Form API v2.5.1


Hero Hook Form API / AdvancedFieldBuilder

Class: AdvancedFieldBuilder<T>

Defined in: builders/AdvancedFormBuilder.ts:339 

Builder pattern for advanced field creation

Type Parameters

T

T extends FieldValues

Constructors

Constructor

new AdvancedFieldBuilder<T>(): AdvancedFieldBuilder<T>

Returns

AdvancedFieldBuilder<T>

Methods

field()

Call Signature

field(type, name, label, props?): this

Defined in: builders/AdvancedFormBuilder.ts:345 

Add any field type using the unified API

Parameters
type

"input"

name

Path<T>

label

string

props?

any

Returns

this

Call Signature

field(type, name, label, props?): this

Defined in: builders/AdvancedFormBuilder.ts:351 

Add any field type using the unified API

Parameters
type

"textarea"

name

Path<T>

label

string

props?

any

Returns

this

Call Signature

field(type, name, label, options, props?): this

Defined in: builders/AdvancedFormBuilder.ts:357 

Add any field type using the unified API

Parameters
type

"select"

name

Path<T>

label

string

options

object[]

props?

any

Returns

this

Call Signature

field(type, name, label, props?): this

Defined in: builders/AdvancedFormBuilder.ts:364 

Add any field type using the unified API

Parameters
type

"checkbox"

name

Path<T>

label

string

props?

any

Returns

this

Call Signature

field(type, name, label, props?): this

Defined in: builders/AdvancedFormBuilder.ts:370 

Add any field type using the unified API

Parameters
type

"switch"

name

Path<T>

label

string

props?

any

Returns

this

Call Signature

field(type, name, label, options, props?): this

Defined in: builders/AdvancedFormBuilder.ts:376 

Add any field type using the unified API

Parameters
type

"radio"

name

Path<T>

label

string

options

object[]

props?

any

Returns

this

Call Signature

field(type, name, label, props?): this

Defined in: builders/AdvancedFormBuilder.ts:383 

Add any field type using the unified API

Parameters
type

"slider"

name

Path<T>

label

string

props?

any

Returns

this

Call Signature

field(type, name, label, props?): this

Defined in: builders/AdvancedFormBuilder.ts:389 

Add any field type using the unified API

Parameters
type

"date"

name

Path<T>

label

string

props?

any

Returns

this

Call Signature

field(type, name, label, props?): this

Defined in: builders/AdvancedFormBuilder.ts:395 

Add any field type using the unified API

Parameters
type

"file"

name

Path<T>

label

string

props?

any

Returns

this


conditionalField()

conditionalField(name, condition, field): this

Defined in: builders/AdvancedFormBuilder.ts:416 

Add a conditional field that shows/hides based on form data

Parameters

name

Path<T>

condition

(formData) => boolean

field

ZodFormFieldConfig<T>

Returns

this


fieldArray()

fieldArray(name, label, fields, options?): this

Defined in: builders/AdvancedFormBuilder.ts:434 

Add a field array for dynamic repeating field groups

Parameters

name

Path<T>

label

string

fields

ZodFormFieldConfig<any>[]

options?
min?

number

max?

number

addButtonText?

string

removeButtonText?

string

Returns

this


dynamicSection()

dynamicSection(name, condition, fields, options?): this

Defined in: builders/AdvancedFormBuilder.ts:462 

Add a dynamic section that shows/hides based on form data

Parameters

name

Path<T>

condition

(formData) => boolean

fields

ZodFormFieldConfig<T>[]

options?
title?

string

description?

string

Returns

this


build()

build(): ZodFormFieldConfig<T>[]

Defined in: builders/AdvancedFormBuilder.ts:486 

Build the final field configuration array

Returns

ZodFormFieldConfig<T>[]