Create KYC Element

createElement('kyc', options?)

Use this function to create an instance of an individual Element.

Parameters

typerequired'kyc'

The type of element you are creating.

optionsoptionalKycElementOptions

Options for creating kyc Element.

Returns

KycElement | null
linkTypeScript
1import { createElement } from '@airwallex/components-sdk';
2
3const element = await createElement('kyc', {
4 hideHeader: true,
5 hideNav: true,
6});

KycElementOptions

Options for creating the KYC Element.

hideHeaderoptionalboolean

If set to true, the onboarding flow header will be hidden, allowing platforms to configure a customized taskflow header on top the Element. By default, the header will be displayed within the onboarding flow and shows the platform's content.

hideNavoptionalboolean

If set to true, the side navigation will be hidden. By default, standard side navigation will be shown.

localeoptional

The locale for the Element, applied to Element UI strings and error messages. By default, the locale configured in init() is used.

KycElement

Functions and external fields that can be used in your integration flow with KYC Element.

destroy()

Destroys the Element instance.

Returns

void
linkTypeScript
1element.destroy();

mount(domElement)

Mounts Element to your HTML DOM.

Parameters

domElementrequiredstring | HTMLElement

The container DOM element to mount the element.

Returns

void
linkTypeScript
1// There are two ways to mount element:
2// 1. Call with container DOM id
3element.mount('container-dom-id');
4
5// 2. Find the created DOM in existing HTML and call with container DOM element
6const containerElement = document.getElementById('container-dom-id');
7element.mount(containerElement);

on(eventCode, handler)

Listen to Element events.

Parameters

The event code to listen for.

The callback function that will be called when the event occurs.

Returns

void
linkTypeScript
1element.on('success', () => {
2 // Handle success event
3});

unmount()

Unmounts the Element. Note that the Element instance will remain.

Returns

void
linkTypeScript
1element.unmount();