Form / foldkit-form

Pipe steps

Every option is also an immutable pipe step (Form.inputs, Form.checks, Form.messages, Form.nested, Form.debounce) that adds to an existing form:

ts
const AuthorForm = Form.make('Author', NewAuthor) // as a library might hand it over

const Finished = AuthorForm.pipe(
  Form.inputs({ bio: Input.multiline() }),
  Form.checks({ name: name => isNameTaken(name) }),
  Form.messages({ required: field => `${field.label} fehlt` }),
)

Keys are typechecked against the form, and Form.checks merges service requirements into the resulting Bundle.