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
theme.cssVariablesWidgetCssVariablesCSS variable overrides for colors, fonts, radius, and per-shape tokens. See Theming.
theme.motionMotionPropsPer-element hover/tap/open transitions. See Theming.
theme.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.

Initial selection

PropTypeDescription
defaultFromChainUid / defaultFromChainId / defaultFromChainKeystringInitial source chain. Changes after initialization do not reset user selection.
defaultToChainUid / defaultToChainId / defaultToChainKeystringInitial destination chain. Changes after initialization do not reset user selection.
defaultFromTokenAddressstringInitial source token. Changes after initialization do not reset user selection.
defaultToTokenAddressstringInitial destination token. Changes after initialization do not reset user selection.

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.

Localization

PropTypeDescription
defaultLanguagestringInitial locale code (e.g. 'en', 'es'). The widget owns language changes after initialization.

Behavior

PropTypeDescription
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.