Getting Started
Install the widget via npm or yarn.
npm install --save @lifi/widget
or
yarn add @lifi/widget

Basic example

Here is an example of a basic app using LI.FI Widget.
integrator option should contain the identifier of the integrator of the widget. It's optional and we will use the web app hostname if it isn't provided.
import { LiFiWidget, WidgetConfig } from '@lifi/widget';
import { useMemo } from 'react';
​
export const WidgetPage = () => {
const widgetConfig: WidgetConfig = useMemo(() => ({
integrator: 'Your dapp/company name',
containerStyle: {
border: `1px solid ${
window.matchMedia('(prefers-color-scheme: dark)').matches
? 'rgb(66, 66, 66)'
: 'rgb(234, 234, 234)'
}`,
borderRadius: '16px',
display: 'flex',
},
}), []);
​
return <LiFiWidget config={widgetConfig} />;
};
Copy link