This page guides you through the steps required to integrate the UI SDK into a non-React application.

Check also the HTML/Javascript demo in the csprclick-examples repository to see the resulting application. In that repo you can find also examples or few other libraries/frameworks.

Download the UI runtime library from the CDN:

Before the closing head tag, add a script element to download the scripts:

  <!-- update to latest released version -->
  <script defer="defer" src=""></script>

Add a container for the UI

In your main layout file, add a <div> container where will inject some UI components like the navigation top bar or the 1-click sign in modal. Set an id, you'll need it later during initialization.

  <div id="app">
    <div id="csprclick-ui"></div>
    <div id="content">
     <!-- you rapplication goes here -->

Also, depending on the layout of your application and the grid system you're using, you'll need to add some CSS styles to this container to match the styles of the rest of the app (width, background color, etc).

Configure the initialization of the SDK

In a javascript file, add the initialization options for the SDK. Make sure this script loads before is downloaded.

The minimal configuration for the UI just defines the container for the navigation top bar and the root container of your app. We'll see other options later in this document.

const clickUIOptions = {
  uiContainer: 'csprclick-ui', 
  rootAppElement: '#app',
  showTopBar: true,  

Next, define Client SDK options:

const clickSDKOptions = {
  appName: ' demo',
  appId: 'csprclick-template',
  providers: ['casper-wallet', 'casper-signer'],

You can read more about the CsprClickInitOptions object in the reference section.

What's next

At this point, your application should show the top navigation bar and you can click on Sign in button to connect your favorite wallet.

Listen to events

You'll need to listen and respond to some events triggered when the user connects an account, switches to a different one, or closes the session.

Refer to the Handling events page for information on how to add your listener functions.

Ask the user to connect a wallet

If you don't display the top navigation bar, you must have your own Sign in or Connect buttons and respond calling the library .

Refer to the Connecting a wallet page for information on how to trigger the wallet connection process.

Request transaction approvals

At some point, your application will need to interact with the Casper network by sending a transaction (aka deploy). manages this process communicating with the active wallet to request the user to approve or reject the transaction. The UI depends on the wallet.

Refer to the Signing transactions page for information on how to request the user a transaction approval.

Customize the top navigation bar

You can add any of our predefined settings selectors or account menu items. And you can define your own.

Refer to the Customizing the top bar section for complete reference on how to work with each of the setting elements in the top bar.

Last updated