Skip to content

@jsvision/forms / FormDialogOptions

Interface: FormDialogOptions<S, I> ​

Defined in: form-dialog.ts:37

Options for formDialog.

Type Parameters ​

S ​

S extends z.ZodObject<z.ZodRawShape>

the Zod object schema type.

I ​

I

the raw initial value shape (keys constrained to the schema).

Properties ​

asyncDebounceMs? ​

optional asyncDebounceMs?: number

Defined in: form-dialog.ts:45

Debounce, in milliseconds, before an async validator runs after a change. Defaults to 300.


asyncValidators? ​

optional asyncValidators?: { [K in string | number | symbol]?: AsyncValidator<I[K]> }

Defined in: form-dialog.ts:43

Opt-in per-field async validators; each force-runs as part of the OK submit gate.


body ​

body: (form) => View

Defined in: form-dialog.ts:49

Build the dialog body — bind widgets to form.field(name).value. Runs once, when the dialog opens.

Parameters ​

form ​

Form<S, I>

Returns ​

View


height ​

height: number

Defined in: form-dialog.ts:60

Dialog height in cells. Required (a placement rect is applied only when both width and height are given).


initial ​

initial: I

Defined in: form-dialog.ts:41

The raw initial editing values (e.g. a coerced-number field is initialised as a string).


okText? ​

optional okText?: string

Defined in: form-dialog.ts:56

OK button label (tilde-marked hotkey, e.g. '~S~ave'). Defaults to '~O~K'.


onSubmit? ​

optional onSubmit?: (values) => void | Promise<void>

Defined in: form-dialog.ts:54

Optional save callback run inside the submit gate with the coerced values. If it rejects, the dialog stays open and OK re-enables; surface the failure through your own body UI (none is minted).

Parameters ​

values ​

output<S>

Returns ​

void | Promise<void>


schema ​

schema: S

Defined in: form-dialog.ts:39

A Zod object schema (a non-string field edited as text must use z.coerce.*).


title? ​

optional title?: string

Defined in: form-dialog.ts:47

Title centered in the dialog's top border.


width ​

width: number

Defined in: form-dialog.ts:58

Dialog width in cells. Required — the body is opaque, so the dialog cannot size itself.