The Form module provides a complete pre-built eKYC form UI that guides users through the identity verification process. It handles the full flow from welcome screen through document selection, data entry, review, submission, and results - all with a single component.The form module supports three configuration types:
OCR - Document capture with automatic data extraction
Manual - Manual data entry by the user
Doc Upload - Document file upload for verification
Verification mode. Defaults to 'individual' for personal KYC.
type
'ocr' | 'manual' | 'doc_upload'
No
Configuration type. Determines the verification flow pattern. Primarily affects the Document Selection, Personal Details, Review, and Retry screens. Static screens (Welcome, Consent, Start) and progress screens (Loading, Result) are not affected. Doc upload screens are only shown when type is 'doc_upload'.
The module options also accept page-level configuration overrides. See Configuration for all available customization options.
The Form module requires provider configuration in your recipe. Form configuration (screens, type, styling) is set through module options when calling sdk.component('form', options), not in the recipe.
Google API key with the Places API enabled. Enables address autocomplete on address field types. Google Maps is optional — when no key is provided, users enter their address manually. Load the Google Maps JS API (<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_KEY&libraries=places"></script>) before initializing OneSdk.
provider.useGoogleAutoCompleteSuggestion
boolean
No
Default: false. When true, uses the newer AutocompleteSuggestion API instead of the deprecated AutocompleteService. As of March 1, 2025, Google deprecated AutocompleteService for new customers — set this to true for new integrations.
CSS selector string (e.g., '#form-container') or HTMLElement object where the form will be mounted
Returns:Promise<WrapperContext> - Resolves when the form is mounted. The WrapperContext contains a cleanup() method.Example:
Copy
Ask AI
// Mount to element by IDawait formComponent.mount('#form-container');// Mount to element referenceconst container = document.getElementById('form-container');await formComponent.mount(container);
User navigated to another screen (document, doc_upload only)
form:review:* events require customResult: trueThe form:review:success, form:review:failed, form:review:partial, and form:review:pending events are only emitted when customResult: true is set in manual mode. When customResult is false (the default), the form automatically navigates to and displays the configured result screen without emitting these events.In OCR mode, the only terminal event is ready on the final screen.
Event Payload:All screen events emit an EventPayload:
Copy
Ask AI
{ componentName?: string; // Module name provider?: string; // Provider name ('react') inputInfo: { name?: string; // Screen name (e.g., 'welcome', 'review') type?: string; // Config type ('ocr', 'manual', 'doc_upload') documentType?: string; // Document type if applicable index?: number; // Document index if applicable }}
Set up event listeners before mounting - Register all event handlers before calling mount() to avoid missing early events like ready and loaded.
Handle all verification outcomes - Listen for success, partial, and pending on both form:review and form:result screens. Don’t assume verification always results in a clear pass/fail.
Use the navigation event for progress tracking - The global navigation event fires on every screen change, making it ideal for progress bars, analytics, and conditional UI outside the form.
Configure type to match your flow - Choose 'ocr', 'manual', or 'doc_upload' based on your integration. The type determines which screens are shown and how data is collected. See Configuration Types.
Customize screens via page config, not DOM manipulation - Use the page configuration and CSS class keys to customize appearance and content rather than manipulating the DOM directly.
Ensure googleApiKey is set in the recipe and the Google Places API is enabled for the key. If using useGoogleAutoCompleteSuggestion, the API key must have the Places API (New) library enabled.
The fields shown on the Review and Personal Details screens depend on the type option and the document type selected. Ensure your form field configuration and country-specific settings match the document types available in your flow.