Superbridge
Start typing to search...
You need a Rollie to use the Superbridge Widget.

Getting Started

Widget

A drop-in React component that adds cross-chain bridging and swapping to your application

The Superbridge Widget is a drop-in React component that adds cross-chain bridging and swapping to your application.

Installation

npm install @superbridge/widget

Peer dependencies

The widget requires the following peer dependencies:

  • react >= 19
  • react-dom >= 19
  • wagmi >= 3
  • @tanstack/react-query >= 5

Quick start

import { Widget } from "@superbridge/widget";
import "@superbridge/widget/styles.css";

function App() {
  return <Widget />;
}

Props

All props are optional. The full set is typed by WidgetProps exported from @superbridge/widget — your editor will autocomplete and document them inline. The most common ones:

Appearance

PropTypeDescription
cssVariablesWidgetCssVariablesCSS variable overrides for colors, fonts, radius, and per-shape tokens. See Theming.
motionMotionPropsPer-element hover/tap/open transitions. See Theming.
textAnimationAnimatedNumberComponentCustom component used to render every animated number in the widget. Must accept { value, format?, className? }. Defaults to a plain formatted span — drop in a flow / scramble / count renderer to animate.

Data & API

PropTypeDescription
apiUrlstringOverride the Superbridge API base URL. Defaults to production.
localDevelopmentApiKeystringDev-only API key for use on localhost. See Local development.
chainsChainDto5[]Restrict the widget to a specific set of chains. Defaults to all chains enabled for your Rollie.

Defaults

PropTypeDescription
defaultFromChainUid / defaultFromChainKeystringPre-select the source chain.
defaultToChainUid / defaultToChainKeystringPre-select the destination chain.
defaultFromTokenAddressstringPre-select the source token.
defaultToTokenAddressstringPre-select the destination token.

Wallets

PropTypeDescription
openEvmWalletModal() => voidOpen your own EVM wallet picker instead of the built-in modal. See Wallet management.
openSvmWalletModal() => voidOpen your own Solana wallet picker.
openStarkWalletModal() => voidOpen your own Starknet wallet picker.

Behavior

PropTypeDescription
languagestringLocale code (e.g. 'en', 'es').
onLanguageChange(language: string) => voidCalled when the user switches language from inside the widget.
urlSyncbooleanSync selected chains/tokens to URL query params. Default true.
keyboardShortcutsbooleanEnable shortcuts like f to open the from-token selector. Default false.
portalTargetHTMLElementRender modals into this element instead of an internal portal. Must have (or live inside) the .sb-widget class so scoped styles apply.
onEvent(event: WidgetEvent) => voidSubscribe to widget events for analytics, logging, or app-side reactions.