Hero Hook Form API / FieldCreationParams
Type Alias: FieldCreationParams<T>
FieldCreationParams<
T> = {type:"input";name:Path<T>;label:string;props?: {type?:"text"|"email"|"tel"|"password"|"number"|"url";placeholder?:string;description?:string;isDisabled?:boolean;className?:string; }; } | {type:"textarea";name:Path<T>;label:string;props?: {placeholder?:string;description?:string;isDisabled?:boolean;className?:string;rows?:number; }; } | {type:"select";name:Path<T>;label:string;options:object[]; } | {type:"autocomplete";name:Path<T>;label:string;options?:object[];getOptions?: () =>object[];props?:Record<string,unknown>;renderItem?: (item) =>React.ReactNode; } | {type:"checkbox";name:Path<T>;label:string;props?: {description?:string;isDisabled?:boolean;className?:string; }; } | {type:"switch";name:Path<T>;label:string;props?: {description?:string;isDisabled?:boolean;className?:string; }; } | {type:"radio";name:Path<T>;label:string;options:object[];props?: {description?:string;isDisabled?:boolean;className?:string;orientation?:"horizontal"|"vertical"; }; } | {type:"slider";name:Path<T>;label:string;props?: {min?:number;max?:number;step?:number;description?:string;isDisabled?:boolean;className?:string; }; } | {type:"date";name:Path<T>;label:string;props?: {placeholder?:string;description?:string;isDisabled?:boolean;className?:string; }; } | {type:"file";name:Path<T>;label:string;props?: {accept?:string;multiple?:boolean;description?:string;isDisabled?:boolean;className?:string; }; } | {type:"fontPicker";name:Path<T>;label:string;props?: {description?:string;isDisabled?:boolean;className?:string;fontPickerProps?: {showFontPreview?:boolean;loadAllVariants?:boolean;onFontsLoaded?: (loaded) =>void;fontsLoadedTimeout?:number; }; }; } | {type:"stringArray";name:Path<T>;label:string;props?: {placeholder?:string;maxItems?:number;minItems?:number;allowDuplicates?:boolean;validateItem?: (item) =>string|true;transformItem?: (item) =>string;addButtonText?:string;showAddButton?:boolean;description?:string;isDisabled?:boolean;className?:string; }; } | {type:"content";name?:Path<T>;label?:string;title?:string|null;description?:string|null;render?: (field) =>React.ReactNode;className?:string; }
Defined in: builders/AdvancedFormBuilder.ts:20
Discriminated union types for field creation parameters This eliminates the need for ‘unknown’ types and type assertions
Type Parameters
T
T extends FieldValues