LogoLogo
CSPR.build PortalCSPR.click Website
CSPR.click (latest)
CSPR.click (latest)
  • Documentation
    • Introduction
    • Overview
    • Getting started
    • Changelog
  • CSPR.click SDK
    • React
      • Handling events
      • Connecting a wallet
      • Signing transactions
      • Customizing the top bar
        • Account dropdown menu
        • Theme selector
        • Network selector
        • Language selector
        • Currency selector
        • Custom selector
      • Hooks and Components
    • JavaScript
      • Handling events
      • Connecting a wallet
      • Signing transactions
      • Customizing the top bar
        • Account dropdown menu
        • Theme selector
        • Network selector
      • Examples
    • Reference
      • Properties
      • Methods
      • Types
      • Events
  • Get support
    • Contact us
Powered by GitBook
On this page
  • Account dropdown menu set up
  • Prebuilt menu items
  • View account on CSPR.live
  • Copy public key
  • Buy CSPR
  • Custom menu item
  1. CSPR.click SDK
  2. JavaScript
  3. Customizing the top bar

Account dropdown menu

Last updated 1 year ago

You can customize the account dropdown menu in our top bar with your own menu items. Options to switch to another account and sign out are always present at the end of the list. The rest, depends on your needs. We provide a couple of common menu item components you may add, and one component for you to include anything you need.

Account dropdown menu set up

To customize the account dropdown menu, add the menu items you want to display into an array:

const csprClickDocsMenuItem = {
    label: 'CSPR.click docs',
    icon: './csprclick-icon.svg',
    badge: { title: 'New', variation: 'green' },
    onClick: () => { window.open('https://docs.cspr.click', '_blank'); },
};

const accountMenuItems = [
    'ViewAccountOnExplorerMenuItem',
    'CopyHashMenuItem',
    csprClickDocsMenuItem,
    'BuyCSPRMenuItem',
];

Then, add the array to the clickUIOptions object you defined before:

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

Prebuilt menu items

View account on CSPR.live

const accountMenuItems = [
    'ViewAccountOnExplorerMenuItem',
    'CopyHashMenuItem',
    csprClickDocsMenuItem,
    'BuyCSPRMenuItem',
];

Renders a menu item in the account dropdown menu to open the CSPR.live account page in a new tab.

Copy public key

const accountMenuItems = [
    'CopyHashMenuItem',
];

Renders a menu item in the account dropdown menu to copy the connected public key to the clipboard.

Buy CSPR

const accountMenuItems = [
    'BuyCSPRMenuItem',
];

Custom menu item

const csprClickDocsMenuItem = {
    label: 'CSPR.click docs',
    icon: './csprclick-icon.svg',
    badge: { title: 'New', variation: 'green' },
    onClick: () => { window.open('https://docs.cspr.click', '_blank'); },
};

const accountMenuItems = [
    csprClickDocsMenuItem,
];

Renders a menu item in the account dropdown menu with a custom text, icon, and handler action.

Optionally, you can add a small badge right to the menu item title. Valid variation values are green, blue, violet, and gray.

Renders a menu item in the account dropdown menu to open the widget on a new tab. This widget allows the user to top-up his account with a credit card payment.

Topper by Uphold