Skip to main content

Function: getFieldTemplateSource()

getFieldTemplateSource(preset): string

Defined in: packages/codegen/src/field-templates.ts:122

Return the source code for the preset's FieldTemplate React component. Used by the CLI generate and init commands to emit a standalone FieldTemplate.tsx alongside generated forms.

Parameters

preset

"shadcn" | "html"

The preset name: 'shadcn' for Radix/shadcn-ui, 'html' for plain HTML.

Returns

string

The complete FieldTemplate.tsx source string for the chosen preset.

Example

const source = getFieldTemplateSource('shadcn');
await fs.writeFile('src/components/FieldTemplate.tsx', source);