Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.li.fi/llms.txt

Use this file to discover all available pages before exploring further.

Widget Light configuration is passed as a WidgetLightConfig object to the config prop of <LiFiWidgetLight>. All configuration must be JSON-serializable because it is sent to the iframe via postMessage.

JSON-Serializable Constraint

Because configuration crosses the iframe boundary via postMessage (which uses the structured clone algorithm), the following are not supported in WidgetLightConfig:
  • React nodes or JSX elements
  • Callback functions
  • Class instances
  • MUI theme objects (palette, colorSchemes, shape, typography, components)
WidgetLightConfig is a curated subset of the full widget config that only exposes serializable fields — the non-serializable options listed above simply aren’t part of the type, so passing them is a TypeScript error. This is enforcement by omission rather than a general serializability guard, so make sure any nested values you do pass are JSON-serializable at runtime. If you need the full configuration surface including React nodes and MUI theming, use the full widget instead.

Required Configuration

The only required field is integrator, which identifies your project in LI.FI analytics:
import type { WidgetLightConfig } from '@lifi/widget-light'

const config: WidgetLightConfig = {
  integrator: 'your-project-name',
}

Configuration Reference

Layout

FieldTypeDescription
variant'compact' | 'wide' | 'drawer'Widget layout variant
mode'default' | 'split' | 'custom' | 'refuel'Widget mode
modeOptionsWidgetModeOptionsOptions for split and custom modes
const config: WidgetLightConfig = {
  integrator: 'my-app',
  variant: 'wide',
  mode: 'split',
  modeOptions: {
    split: { defaultTab: 'bridge' },
  },
}

Appearance

FieldTypeDescription
appearance'light' | 'dark' | 'system'Color scheme preference
themeWidgetThemeCSS-based theme overrides (see below)
The theme object supports CSS properties for specific containers. This is not a MUI theme — only serializable CSS properties are accepted:
const config: WidgetLightConfig = {
  integrator: 'my-app',
  appearance: 'dark',
  theme: {
    container: {
      border: '1px solid #eaeaea',
      borderRadius: '16px',
    },
    header: {
      background: '#f5f5f5',
    },
    navigation: {
      edge: true,
    },
  },
}
WidgetTheme fields:
FieldTypeDescription
containerCSS propertiesStyles for the widget container
routesContainerCSS propertiesStyles for the routes list container
chainSidebarContainerCSS propertiesStyles for the chain sidebar (wide variant)
headerCSS propertiesStyles for the widget header
navigation{ edge?: boolean }Navigation layout options

Chain and Token Selection

FieldTypeDescription
fromChainnumberPre-selected source chain ID
toChainnumberPre-selected destination chain ID
fromTokenstringPre-selected source token address
toTokenstringPre-selected destination token address
fromAmountnumber | stringPre-filled source amount
toAmountnumber | stringPre-filled destination amount
minFromAmountUSDnumberMinimum source amount in USD
toAddressWidgetToAddressPre-filled destination address
toAddressesWidgetToAddress[]List of selectable destination addresses
formUpdateKeystringKey to force form update

API and Fees

FieldTypeDescription
apiKeystringYour LI.FI API key
feeConfigWidgetFeeConfigFee configuration
referrerstringReferrer identifier
WidgetFeeConfig fields:
FieldTypeDefaultDescription
namestringDisplay name for the fee
logoURIstringLogo URL for the fee
feenumberFee percentage (0 to 1)
showFeePercentagebooleanfalseShow the fee as a percentage
showFeeTooltipbooleanfalseShow an informational tooltip

Routing

FieldTypeDescription
routePriority'RECOMMENDED' | 'FASTEST' | 'CHEAPEST' | 'SAFEST'Default route sorting priority
slippagenumberDefault slippage tolerance
showSingleRoutebooleanShow only the recommended route and hide route selector
useRelayerRoutesbooleanEnable gasless/relayer routes

SDK Configuration

The sdkConfig field controls API and routing behavior:
const config: WidgetLightConfig = {
  integrator: 'my-app',
  sdkConfig: {
    apiUrl: 'https://li.quest/v1',
    routeOptions: {
      maxPriceImpact: 0.4,
      bridges: { allow: ['stargate', 'across'] },
      exchanges: { deny: ['dodo'] },
    },
    rpcUrls: {
      1: ['https://your-eth-rpc.com'],
      137: ['https://your-polygon-rpc.com'],
    },
  },
}
WidgetSDKConfig fields:
FieldTypeDescription
apiUrlstringCustom LI.FI API URL
userIdstringUser identifier for tracking
rpcUrlsRecord<number, string[]>Custom RPC URLs per chain ID
routeOptionsWidgetRouteOptionsRouting options (see below)
preloadChainsbooleanPreload chain data on init
chainsRefetchIntervalnumberChain data refetch interval (ms)
WidgetRouteOptions fields:
FieldTypeDescription
maxPriceImpactnumberMaximum acceptable price impact
allowSwitchChainbooleanAllow chain switching during execution
allowDestinationCallbooleanAllow destination chain contract calls
bridges{ allow?, deny?, prefer? }Bridge allow/deny/prefer lists
exchanges{ allow?, deny?, prefer? }Exchange allow/deny/prefer lists
jitoBundlebooleanEnable Jito bundle support for Solana
fee, referrer, order, and slippage are not available in sdkConfig.routeOptions. Use the top-level feeConfig, referrer, routePriority, and slippage config fields instead.

Allow/Deny Lists

Filter which chains, tokens, bridges, and exchanges are available:
const config: WidgetLightConfig = {
  integrator: 'my-app',
  chains: {
    allow: [1, 137, 42161],          // Only show these chains
    from: { allow: [1, 137] },       // Source chain filter
    to: { deny: [56] },              // Destination chain filter
    types: { allow: ['EVM', 'SVM'] }, // Filter by chain type
  },
  tokens: {
    featured: [{ chainId: 1, address: '0x...', symbol: 'USDC', decimals: 6, name: 'USD Coin' }],
    allow: [{ chainId: 1, address: '0x...' }],
    deny: [{ chainId: 1, address: '0x...' }],
  },
  bridges: {
    allow: ['stargate', 'across'],
  },
  exchanges: {
    deny: ['dodo'],
  },
}

UI Controls

Control which UI elements are visible, disabled, or required. Each option uses an object config where keys are UI element names and values are booleans:
FieldTypeDescription
hiddenUIWidgetHiddenUIConfigUI elements to hide
disabledUIWidgetDisabledUIConfigUI elements to disable (visible but not interactive)
requiredUIWidgetRequiredUIConfigUI elements that must be filled before proceeding
defaultUIWidgetDefaultUIDefault UI state overrides
hiddenUI keys: appearance, drawerCloseButton, history, language, poweredBy, toAddress, fromToken, toToken, walletMenu, integratorStepDetails, reverseTokensButton, routeTokenDescription, routeCardPriceImpact, chainSelect, chainSidebar, bridgesSettings, addressBookConnectedWallets, lowAddressActivityConfirmation, gasRefuelMessage, searchTokenInput, insufficientGasMessage, contactSupport, hideSmallBalances, allNetworks disabledUI keys: fromAmount, fromToken, toAddress, toToken requiredUI keys: toAddress, accountDeployedMessage
const config: WidgetLightConfig = {
  integrator: 'my-app',
  hiddenUI: { appearance: true, language: true, poweredBy: true },
  disabledUI: { toAddress: true },
  requiredUI: { toAddress: true },
  defaultUI: {
    transactionDetailsExpanded: true,
    navigationHeaderTitleNoWrap: false,
  },
}

Wallet Configuration

FieldTypeDescription
walletConfig.walletEcosystemsOrderRecord<string, WidgetChainType[]>Custom wallet ecosystem ordering
walletConfig.usePartialWalletManagementbooleanEnable partial wallet management
walletConfig.forceInternalWalletManagementbooleanForce the widget’s internal wallet UI
The walletConfig.useExternalWalletManagement field is set automatically when you pass onConnect to the component. You do not need to set it manually.

Internationalization

FieldTypeDescription
languagesWidgetLanguagesLanguage configuration
languageResourcesWidgetLanguageResourcesCustom translation strings
Supported language keys: en, es, fr, de, it, pt, ja, ko, zh, hi, bn, th, vi, tr, uk, id, pl
const config: WidgetLightConfig = {
  integrator: 'my-app',
  languages: {
    default: 'de',
    allow: ['en', 'de', 'fr'],
  },
}

Miscellaneous

FieldTypeDescription
buildUrlbooleanSync widget state to URL parameters
keyPrefixstringPrefix for local storage keys
explorerUrlsRecord<number, WidgetExplorerUrl[]>Custom block explorer URLs per chain
poweredBy'default' | 'jumper'”Powered by” branding variant
routeLabelsWidgetRouteLabelRule[]Custom labels for routes matching specific criteria
contractCallsWidgetContractCall[]Contract calls for the custom mode
contractToolWidgetContractToolTool branding for contract calls

Reactive Config Updates

Configuration is reactive. When you pass a new config object, the widget updates in real-time without reloading the iframe:
import { LiFiWidgetLight } from '@lifi/widget-light'
import type { WidgetLightConfig } from '@lifi/widget-light'
import { useMemo, useState } from 'react'

const baseConfig: WidgetLightConfig = {
  integrator: 'my-app',
}

function App() {
  const [variant, setVariant] = useState<'wide' | 'compact'>('wide')

  const widgetConfig = useMemo(
    () => ({ ...baseConfig, variant }),
    [variant]
  )

  return (
    <>
      <button onClick={() => setVariant('compact')}>Compact</button>
      <button onClick={() => setVariant('wide')}>Wide</button>
      <LiFiWidgetLight config={widgetConfig} handlers={handlers} />
    </>
  )
}
Config changes are sent to the iframe via the CONFIG_UPDATE message after the initial handshake. The widget applies the new configuration without a full reload, preserving any in-progress state.