Skip to main content

External modal

You may want to use your own design and/or change some logic for the modal. In that case passing all of the overrides to the build() or buildLazy() function can prove ineffective. Another option therfore is to omit the default modal altogether, by specyfing the disableModal option as true inside the connectionOptions.

You can then use the modal connect function, instead of using the default one from the adapter.


Example below is written for Solana, but you can use it for Sui, Aptos and Substrate as well.

import { NightlyConnectAdapter } from '@nightlylabs/wallet-selector-solana'
// You have to import the modal class separately
import { AppInitData, NightlyConnectSelectorModal } from '@nightlylabs/wallet-selector-base'

const appInitData: AppInitData = {
appMetadata: {
name: 'NCTestSolana',
description: 'Nightly Connect Test',
icon: '',
additionalInfo: 'Courtesy of Nightly Connect team'

const adapter = await
{ disableModal: true } // ensures that the default modal will be disabled

Now you can define and instantiate your own modal and use the adapter to provide any necessary logic.


The example below shows the process using the NightlyConnectSelectorModal, but the code may look different, depending on the underlying code in your modal of choice.

// creates a new modal
const modal = new NightlyConnectSelectorModal(
appInitData.url ?? '',
icon: ''

// we can also use events to determine,
// what the current state of the app is, and react accordingly
adapter.on('connect', (pk) => {

The code described above sets up the adapter and the modal for later use.

To connect, we can run:

if (modal)
modal.openModal(adapter?.sessionId ?? undefined, async (walletName) => {
try {
await adapter?.connectToWallet(walletName)
} catch (err) {

You may include some additional functionality on top of the basic code. For more customization freedom, visit the source code for any adapter, e.g