Skip to Content
ContentAPIClassesClass: TypeInferredBuilder<T>

Hero Hook Form API v2.5.1


Hero Hook Form API / TypeInferredBuilder

Class: TypeInferredBuilder<T>

Defined in: builders/TypeInferredBuilder.ts:10 

Type-inferred form builder that auto-generates both schema and field configs

Type Parameters

T

T extends FieldValues

Constructors

Constructor

new TypeInferredBuilder<T>(): TypeInferredBuilder<T>

Returns

TypeInferredBuilder<T>

Methods

text()

text(name, label, options?): this

Defined in: builders/TypeInferredBuilder.ts:17 

Add a text field

Parameters

name

Path<T>

label

string

options?
placeholder?

string

description?

string

isDisabled?

boolean

className?

string

minLength?

number

maxLength?

number

pattern?

string

Returns

this


email()

email(name, label, options?): this

Defined in: builders/TypeInferredBuilder.ts:67 

Add an email field

Parameters

name

Path<T>

label

string

options?
placeholder?

string

description?

string

isDisabled?

boolean

className?

string

Returns

this


number()

number(name, label, options?): this

Defined in: builders/TypeInferredBuilder.ts:96 

Add a number field

Parameters

name

Path<T>

label

string

options?
placeholder?

string

description?

string

isDisabled?

boolean

className?

string

min?

number

max?

number

step?

number

Returns

this


textarea()

textarea(name, label, options?): this

Defined in: builders/TypeInferredBuilder.ts:135 

Add a textarea field

Parameters

name

Path<T>

label

string

options?
placeholder?

string

description?

string

isDisabled?

boolean

className?

string

rows?

number

minLength?

number

Returns

this


select()

select(name, label, options): this

Defined in: builders/TypeInferredBuilder.ts:174 

Add a select field

Parameters

name

Path<T>

label

string

options

object[]

Returns

this


checkbox()

checkbox(name, label, options?): this

Defined in: builders/TypeInferredBuilder.ts:198 

Add a checkbox field

Parameters

name

Path<T>

label

string

options?
description?

string

isDisabled?

boolean

className?

string

required?

boolean

Returns

this


switch()

switch(name, label, options?): this

Defined in: builders/TypeInferredBuilder.ts:235 

Add a switch field

Parameters

name

Path<T>

label

string

options?
description?

string

isDisabled?

boolean

className?

string

Returns

this


radio()

radio(name, label, options, fieldOptions?): this

Defined in: builders/TypeInferredBuilder.ts:261 

Add a radio field

Parameters

name

Path<T>

label

string

options

object[]

fieldOptions?
description?

string

isDisabled?

boolean

className?

string

orientation?

"horizontal" | "vertical"

Returns

this


slider()

slider(name, label, options?): this

Defined in: builders/TypeInferredBuilder.ts:292 

Add a slider field

Parameters

name

Path<T>

label

string

options?
min?

number

max?

number

step?

number

description?

string

isDisabled?

boolean

className?

string

Returns

this


date()

date(name, label, options?): this

Defined in: builders/TypeInferredBuilder.ts:330 

Add a date field

Parameters

name

Path<T>

label

string

options?
placeholder?

string

description?

string

isDisabled?

boolean

className?

string

Returns

this


file()

file(name, label, options?): this

Defined in: builders/TypeInferredBuilder.ts:359 

Add a file field

Parameters

name

Path<T>

label

string

options?
accept?

string

multiple?

boolean

description?

string

isDisabled?

boolean

className?

string

Returns

this


build()

build(): object

Defined in: builders/TypeInferredBuilder.ts:387 

Build the final schema and fields

Returns

object

schema

schema: ZodType<T>

fields

fields: ZodFormFieldConfig<T>[]