Skip to content

ChildTableConfig

ChildTableConfig = object

Defined in: packages/forms/src/types.ts:200

Configuration for a child table rendered as a dynamic field array under a parent AutoForm.

Child tables are introspected the same way the parent table is — column types, required flags, enums, and v() validation rules all flow through. The rendered form exposes add / remove (and optionally reorder) controls and submits a typed array of rows under the configured key.

createAutoForm({
table: recipes,
children: {
ingredients: {
table: ingredients,
foreignKey: "recipe_id",
minRows: 1,
maxRows: 50,
reorderable: true,
fields: { name: {}, amount: { placeholder: "g" } },
},
},
onSubmit: async (values) => {
// values.ingredients is the typed array of child rows
},
});

optional addLabel: string

Defined in: packages/forms/src/types.ts:222

Override the “Add row” button label.


optional exclude: string[]

Defined in: packages/forms/src/types.ts:218

Additional column names to omit from the rendered child rows.


optional fields: Partial<Record<string, FieldConfig>>

Defined in: packages/forms/src/types.ts:216

Per-column overrides for the child table fields, identical in shape to the parent FieldConfig.


foreignKey: string

Defined in: packages/forms/src/types.ts:208

Foreign key column on the child table that points back at the parent. The column is automatically excluded from the rendered child fields and stamped onto each row at submit time.


optional label: string

Defined in: packages/forms/src/types.ts:220

Override the heading rendered above the child table (defaults to a humanised key).


optional maxRows: number

Defined in: packages/forms/src/types.ts:212

Maximum number of rows the user is allowed to add. Defaults to unlimited.


optional minRows: number

Defined in: packages/forms/src/types.ts:210

Minimum number of rows the user must provide. Defaults to 0.


optional reorderable: boolean

Defined in: packages/forms/src/types.ts:214

Show reorder controls (move up / move down). Defaults to false.


table: SQLiteTable

Defined in: packages/forms/src/types.ts:202

The Drizzle SQLite table that backs each row of the array.