Skip to main content
Complete reference documentation for the @uphold/enterprise-kyc-widget-web-sdk package. The main class for creating and managing KYC Widget instances is KycWidget. It requires a KycWidgetSession object that must be created through the API before instantiating the Widget.

Constructor

Parameters:

Options

layout option: The layout option controls how the Widget is laid out when there is enough room to frame it — on viewports that are both at least md wide (≥768px) and at least 600px tall, i.e. tablets and up. On smaller viewports — narrower or shorter, including phones in landscape — the Widget always fills its container regardless of this option.
  • 'boxed' (default): on viewports that are ≥768px wide and ≥600px tall, centers the Widget and frames its content as a fixed-size card; on smaller viewports it fills its container. Use this when the Widget takes up the whole page (e.g. mounted into a full-page container).
  • 'fluid': renders the Widget so it fills its container, with no frame or centering, so your own container (e.g. a modal or a sized panel) acts as the frame.
Most integrations should rely on the default 'boxed' and only set layout: 'fluid' when embedding the Widget in your own framed container.
Use 'fluid' when you already provide a centered container or modal around the Widget, to avoid a card-within-a-card appearance on larger viewports.
theme option: The theme option lets you control the visual appearance of the Widget. By default, the Widget automatically detects and matches the user’s browser or OS appearance preference (light or dark). Use this option when you want to enforce a specific theme regardless of the user’s system settings.

Methods

mountIframe()

Mounts the KYC Widget iframe to the specified DOM element. Parameters:
  • element: The HTML element where the Widget should be mounted
Example:
The container element should have explicit dimensions set via CSS. The Widget will fill the entire container. Minimum recommended size is 400px width × 600px height for optimal user experience.

unmount()

Unmounts and cleans up the KYC Widget iframe. Example:
The Widget will not unmount itself when a flow is finished, either by successful completion, user cancellation, or unrecoverable error, so it must always be called manually.

on()

Registers an event listener for Widget events. Parameters:
  • event: The event name to listen for
  • callback: Function to execute when the event is triggered
Example:

off()

Removes an event listener for KYC Widget events. Parameters:
  • event: The event name to stop listening for
  • callback: The specific function to remove (must be the same reference as used in on())
Example:

Events

The KYC Widget emits several events during its lifecycle that you can listen to using the on() method.

complete

Fired when all KYC processes have been submitted.
Example:
The complete event signals submission, not approval. Final verification outcomes are delivered asynchronously via KYC webhooks. Monitor those server-side to update your user’s status.

cancel

Fired when the user cancels the KYC flow.
Example:

error

Fired when an unrecoverable error occurs during the KYC flow.
Example:

ready

Fired when the KYC Widget has finished loading.
Example:

Types

KycWidgetSession

The session object returned by the Create session endpoint.

WidgetLayout

Controls how the Widget is laid out on larger viewports.

WidgetThemeOption

Controls the visual appearance of the Widget.

ColorTokenValue

A color value that can be a single string applied to both light and dark modes, or separate values per mode.

FontFamily

A font family that can be a single string applied to all slots, or separate values per slot (mono, sans, serif).

Complete usage example

Here’s an end-to-end example showing how to use the KYC Widget with all events: