LogoLogo
CSPR.build PortalCSPR.click Website
CSPR.click v1.3
CSPR.click v1.3
  • Introduction
    • CSPR.click overview
    • Get your application Id
    • Changelog
  • UI SDK
    • Getting started with the template application
    • Integrating the UI SDK into your application
    • Integrating the UI SDK into a non-React application
    • Customizing the top bar
      • Account dropdown menu
      • Theme selector
      • Network selector
      • Language selector
      • Currency selector
      • Custom selector
    • useClickRef() hook
    • Handling events
    • Signing transactions
  • Core JS SDK
    • Getting started
    • Properties
    • Methods
    • Types
    • Events
  • Get support
    • Contact us
Powered by GitBook
On this page
  1. UI SDK
  2. Customizing the top bar

Currency selector

PreviousLanguage selectorNextCustom selector

Last updated 11 months ago

If your application supports multiple currencies, you can add to the CSPR.click toolbar a currency selector widget adding a CurrencySettings object to the <ClickUI> component:

const currencySettings= {
  currencies: CURRENCIES,
  currentCurrency: currency,
  onChangeCurrency: (c: any) => { setCurrency(c); },
}
<ClickUI
    topBarSettings={{
        currencySettings
    }}
/>

The settings object must have a currencies property with an array containing the currencies your application can handle. Set them in the order you want to appear in the selector:

const CURRENCIES = [
    {
        code: "USD",
        title: "US Dollar",
        type_id: CurrencyType.FIAT,
        icon: '',
    },
    {
        code: "EUR",
        title: "Euro",
        type_id: CurrencyType.FIAT,
        icon: '',
    },
    {
        code: "BTC", 
        title: "Bitcoin",
        type_id: CurrencyType.CRYPTO,
        icon: '',
    }
];

Note in the image above how currencies are grouped in cryptocurrencies and fiat currencies. In your list of currencies, classify them using the type_id property in one of the groups.

Currency selector widget