Form / foldkit-form/metakit

Declared

namespace · packages/form/src/metakit.ts:362

const Declared = { of, inputs, CalendarDay, Decimal }

In the guides

Members

Declared.of

function · packages/form/src/metakit.ts:271

of<Fields extends Schema.Struct.Fields, Model, FieldKey extends string>(
  form: DeclaredForm<Fields, Model, FieldKey>,
  options?: DeclaredOptions<Fields>,
): Declarations<Fields, Model, FieldKey>

A form's declarations: each key's constraint and the input's rules over several keys, read once here; whether a guarded transition would go through with the values entered so far; and which of those rules they break.

Declared.inputs

function · packages/form/src/metakit.ts:239

inputs<Fields extends Schema.Struct.Fields>(
  schema: Schema.Struct<Fields>,
): {
  readonly [K in keyof Fields]?: Control
}

The controls a Schema's domain types call for, by key: Declared.CalendarDay for a CalendarDay, Declared.Decimal for Money and Decimal. Give them to Form.make under inputs; a control given for the same key after them replaces the derived one.

Declared.CalendarDay

const · packages/form/src/metakit.ts:130

CalendarDay: ControlKind<Record<string, never>>

The control inputs gives a CalendarDay key, for a renderer to recognise (Declared.CalendarDay.is).

Declared.Decimal

const · packages/form/src/metakit.ts:142

Decimal: ControlKind<Scaled>

The control inputs gives a Money or Decimal key; its data is the domain's, scale included.