@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
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.
'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 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
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:
on()
Registers an event listener for Widget events.
Parameters:
event: The event name to listen forcallback: Function to execute when the event is triggered
off()
Removes an event listener for KYC Widget events.
Parameters:
event: The event name to stop listening forcallback: The specific function to remove (must be the same reference as used inon())
Events
The KYC Widget emits several events during its lifecycle that you can listen to using theon() method.
complete
Fired when all KYC processes have been submitted.
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.
error
Fired when an unrecoverable error occurs during the KYC flow.
ready
Fired when the KYC Widget has finished loading.
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).