Skip to main content

Login Modal

The Web3Auth Plug and Play Modal offers a user-friendly interface that enables your dApp to connect with various login methods and adapters provided by Web3Auth. By whitelabeling the Login Modal, your dApp can maintain a consistent user experience. You can customize the theme, choose from 8+ languages supported and provide your dApp name and brand logo, along with other options for detailed customization across all our offerings.

Web3Auth Plug and Play Login Modal

Arguments

uiConfig

You can pass the uiConfig parameters to @web3auth/modal to whitelabel your Web3Auth Login Modal.

ParameterDescription
loginMethodsOrderorder of how login methods are shown
modalZIndexZ-index of the modal and iframe
displayErrorsOnModalWhether to show errors on Web3Auth modal.
loginGridColnumber of columns to display the Social Login buttons
primaryButtonDecides which button will be the focus of the modal
uxModeUX Mode for the openlogin adapter
appName?App name to be displayed in the User Flow Screens. It accepts string as a value.
appUrl?App URL to be displayed in the User Flow Screens. It accepts string as a value.
logoLight?App logo to be shown on the light background (light theme). It accepts string as a value.
logoDark?App logo to be shown on the dark background (dark theme). It accepts string as a value.
defaultLanguage?Default Language to use.
Choose from:
  • en - English
  • de - German
  • ja - Japanese
  • ko - Korean
  • zh - Mandarin
  • es - Spanish
  • fr - French
  • pt - Portuguese
  • nl - Dutch
  • tr - Turkish
. Default language is en
mode?Choose between auto, light or dark background modes. Default is auto.
theme?Used to customize the theme of the login modal with the following options
'primary' - To customize the primary color of the modal's content. It accepts Record as a value.
tncLink?Language specific link for terms and conditions on torus-website. See (examples/vue-app) to configure e.g. tncLink: {en: "http://example.com/tnc/en", ja: "http://example.com/tnc/ja"}
privacyPolicy?Language specific link for privacy policy on torus-website. See (examples/vue-app) to configure e.g. privacyPolicy: { en: "http://example.com/tnc/en", ja: "http://example.com/tnc/ja", }

WhiteLabelData

whiteLabel?: WhiteLabelData;

The whitelabel parameter takes WhitelabelData as input. The WhitelabelData object takes the following parameters:

WhiteLabelData

ParameterDescription
appName?App name to be displayed in the User Flow Screens. It accepts string as a value.
appUrl?App URL to be displayed in the User Flow Screens. It accepts string as a value.
logoLight?App logo to be shown on the light background (light theme). It accepts string as a value.
logoDark?App logo to be shown on the dark background (dark theme). It accepts string as a value.
defaultLanguage?Default Language to use.
Choose from:
  • en - English
  • de - German
  • ja - Japanese
  • ko - Korean
  • zh - Mandarin
  • es - Spanish
  • fr - French
  • pt - Portuguese
  • nl - Dutch
  • tr - Turkish
. Default language is en
mode?Choose between auto, light or dark background modes. Default is auto.
theme?Used to customize the theme of the login modal with the following options
'primary' - To customize the primary color of the modal's content. It accepts Record as a value.
tncLink?Language specific link for terms and conditions on torus-website. See (examples/vue-app) to configure e.g. tncLink: {en: "http://example.com/tnc/en", ja: "http://example.com/tnc/ja"}
privacyPolicy?Language specific link for privacy policy on torus-website. See (examples/vue-app) to configure e.g. privacyPolicy: { en: "http://example.com/tnc/en", ja: "http://example.com/tnc/ja", }

Example

import { Web3Auth } from "@web3auth/modal";
import { CHAIN_NAMESPACES } from "@web3auth/base";

const web3auth = new Web3Auth({
// type uiConfig
uiConfig: {
appName: "W3A",
theme: {
primary: "red",
},
mode: "dark",
logoLight: "https://web3auth.io/images/web3auth-logo.svg",
logoDark: "https://web3auth.io/images/web3auth-logo---Dark.svg",
defaultLanguage: "en", // en, de, ja, ko, zh, es, fr, pt, nl
loginGridCol: 3,
primaryButton: "externalLogin", // "externalLogin" | "socialLogin" | "emailLogin"
},
chainConfig: { chainNamespace: CHAIN_NAMESPACES.EIP155 },
clientId:
"BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ",
web3AuthNetwork: "sapphire_mainnet",
});

uiConfig

appName

appName

appLogo

theme

theme

loginMethodsOrder

loginMethodsOrder

defaultLanguage

en - English

en

de - German

de

ja - Japanese

ja

ko - Korean

ko

zh - Chinese (Mandarin)

zh

es - Spanish

es

fr - French

fr

pt - Portuguese

pt

nl - Dutch

nl

loginGridCol

loginGridCol

primaryButton

primaryButton

More customization

initModal

Disable few Social Login Methods

import { Web3Auth } from "@web3auth/modal";
import { CHAIN_NAMESPACES, WALLET_ADAPTERS } from "@web3auth/base";

const web3auth = new Web3Auth({
chainConfig: { chainNamespace: CHAIN_NAMESPACES.EIP155 },
clientId:
"BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ",
web3AuthNetwork: "sapphire_mainnet",
});

await web3auth.initModal({
modalConfig: {
[WALLET_ADAPTERS.OPENLOGIN]: {
label: "openlogin",
loginMethods: {
// Disable facebook and reddit
facebook: {
name: "facebook",
showOnModal: false,
},
reddit: {
name: "reddit",
showOnModal: false,
},
},
},
},
});

Disable Email or SMS Login Methods

import { Web3Auth } from "@web3auth/modal";
import { CHAIN_NAMESPACES, WALLET_ADAPTERS } from "@web3auth/base";

const web3auth = new Web3Auth({
chainConfig: { chainNamespace: CHAIN_NAMESPACES.EIP155 },
clientId:
"BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ",
web3AuthNetwork: "sapphire_mainnet",
});

await web3auth.initModal({
modalConfig: {
[WALLET_ADAPTERS.OPENLOGIN]: {
label: "openlogin",
loginMethods: {
// Disable email_passwordless and sms_passwordless
email_passwordless: {
name: "email_passwordless",
showOnModal: false,
},
sms_passwordless: {
name: "sms_passwordless",
showOnModal: false,
},
},
},
},
});

Disable External Wallet Options

import { Web3Auth } from "@web3auth/modal";
import { CHAIN_NAMESPACES, WALLET_ADAPTERS } from "@web3auth/base";

const web3auth = new Web3Auth({
chainConfig: { chainNamespace: CHAIN_NAMESPACES.EIP155 },
clientId:
"BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ",
web3AuthNetwork: "sapphire_mainnet",
});

await web3auth.initModal({
modalConfig: {
// Disable Wallet Connect V2
[WALLET_ADAPTERS.WALLET_CONNECT_V2]: {
label: "wallet_connect",
showOnModal: false,
},
// Disable Metamask
[WALLET_ADAPTERS.METAMASK]: {
label: "metamask",
showOnModal: false,
},
},
});