Skip to main content

Push Universal Account Button

PushUniversalAccountButton is a versatile, state-aware button component for wallet connections in the Push Chain ecosystem. It handles the complete user journey from connection initiation through authentication to displaying the connected account state, with extensive customization options for each state.

Installation

# UI Kit SDK
npm install @pushchain/ui-kit

Usage

Place the button in your UI where users should be able to connect. The button must be used within a PushUniversalWalletProvider.

REACT PLAYGROUND
import {
  PushUniversalWalletProvider,
  PushUniversalAccountButton,
  PushUI,
} from '@pushchain/ui-kit';

function App() {
  return (
    <PushUniversalWalletProvider
      config={{
        uid: 'basic',
        network: PushUI.CONSTANTS.PUSH_NETWORK.TESTNET
      }}
    >
      <PushUniversalAccountButton
        uid='basic'
        connectButtonText='Start Building 🔥'
        modalAppOverride={{
          title: 'Override App Title on Modal',
        }}
        loginAppOverride={{
          title: 'Override App Title on Login',
        }}
        themeOverrides={{
          '--pwauth-btn-connect-bg-color': ' #3459F0', // or override theme
        }}
      />
    </PushUniversalWalletProvider>
  );
}
LIVE APP PREVIEW

Props

PropertyTypeDefaultDescription
connectButtonTextstringConnect AccountText for the connect button.
loadingComponentReact.ReactNodeUses default loaderCustom loading indicator.
uidstringUses default providerOptional ID for targeting a specific wallet instance, must match config.uid of specific PushUniversalWalletProvider instance.
 
See multiple wallet example for usage.
themeOverridesThemeOverrides{}Button theme overrides. Check out all the supported theme variables in Theme Variables.
loginAppOverrideObject**Used to override app preview in the login screen. ** See loginAppOverride prop for more info.
modalAppOverrideObject**Used to override app preview in the modal presented. ** See modalAppOverride prop for more info.

loginAppOverride props

Use this to override app preview that is provided on login screen for a particular button instance. This will override the app preview that is provided in the app prop of PushUniversalWalletProvider.

PropertyTypeDefaultDescription
logoUrlstringFrom Provider's -> app.logoUrlOverride app logo in login screen.
titlestringFrom app.titleOverride app title in login screen.
descriptionstringFrom app.descriptionOverride app description in login screen.

modalAppOverride props

Use this to override app preview that is provided on wallet modal for a particular button instance. This will override the app preview that is provided in the app prop of PushUniversalWalletProvider.

PropertyTypeDefaultDescription
logoUrlstringFrom app.logoUrlOverride app logo in modal.
titlestringFrom app.titleOverride app title in modal.
descriptionstringFrom app.descriptionOverride app description in modal.

Handling Connection Lifecycle

You can track and customize the wallet connection lifecycle with usePushWalletContext.

Next Steps