Prodular UI

AI form fill

Pro

Fills a Form from a document, an email or a record. Suggestions stream in under each field with where they came from and how sure the model is; people accept or dismiss them one by one or all at once, and Accept all can be undone.

npx prodular-ui add ai-form-fill

Part of Prodular UI Pro. Preview and read the docs freely, install with a license. See pricing

An expense from a receipt

Fill from receipt streams five fields from a simulated model. The purpose comes from the calendar with low confidence; hover the meter for the quote.

Source receipt-tavares-rico.jpg
€

Anatomy

<Form form={form} onSubmit={save}>  <AiFormFill run={readReceipt} source="receipt.jpg">    <AiFormFillBar />    <FormField name="merchant" label="Merchant">      {(field) => (<><Input {...field} /><AiFormFillSuggestion name="merchant" /></>)}    </FormField>  </AiFormFill></Form>

Guidance

Use it when

  • Forms people fill from something they already have: receipts, invoices, emails, contracts, CRM records.
  • Sources and confidence so people know which suggestions to check.
  • Inside Form, with AiFormFillSuggestion in each field's render function under its control.

Avoid

  • Writing values straight into fields. Suggestions only apply when accepted.
  • Free text editing. Use AI field actions for rewriting what people wrote.

Rules for AI agents

Published in llms-full.txt, the registry and the MCP server, so coding agents follow them when they build with this component.

  • Wrap the fields in AiFormFill inside Form and pass run(signal). On the server, extract an object with the same field names, for example with the AI SDK's streamObject and a Zod schema, and return its partialObjectStream.
  • Each suggestion is { value, display?, source?: { label, quote? }, confidence? }. value must have the field's type; display is what people read.
  • Suggestions equal to the current value are skipped. Accepting validates the field through React Hook Form.
  • Place AiFormFillBar at the top of the form and AiFormFillSuggestion name="field" right after each control.
  • Throw from run with a message that names the source to show an error with Try again.

API

AiFormFill

PropTypeDefaultDescription
run(signal) => AsyncIterable<Partial<AiFormFillResult>> | Promise<AiFormFillResult>Reads the source and returns suggestions by field name.
sourcestringWhat is read, as people know it.

AiFormFillBar

PropTypeDefaultDescription
labelstring"Fill with AI"The start button.

AiFormFillSuggestion

PropTypeDefaultDescription
namestringThe field this suggestion belongs to.

useAiFormFill

PropTypeDefaultDescription
returns{ status, pending, start, cancel, accept, reject, acceptAll, rejectAll, undo, canUndo }For your own controls.

Installation

The Prodular UI CLI adds the source to components/ui with everything it depends on. In a project that already uses shadcn/ui, the shadcn CLI installs it from the Prodular registry too. See Installation for the first setup.

npx prodular-ui add ai-form-fill# or, with the registry in components.jsonnpx shadcn@latest add @prodular/ai-form-fill