Customize the look and feel of the widget to match the design of your dApp and suit your needs
LI.FI Widget supports visual customization, allowing you to match your web app's design. The widget's layout stays consistent, but you can modify colors, fonts, border radius, container styles, disable or hide parts of the UI, and more.
Start customizing the widget by tweaking some of the following options:
Check out our LI.FI Playground to play with customization options in real time.
By customizing the theme, you can ensure the LI.FI Widget matches the look and feel of your application, providing a seamless user experience.
The theme
configuration option allows you to customize various aspects of the widget's appearance, including colors, typography, shapes, and component styles.
The container
option customizes the main container of the widget. In the example below, we adjust the border and border-radius properties of the container.
The palette
option defines the color palette for the widget. You can customize the background colors, greyscale colors, primary and secondary colors, and text colors.
The shape
option defines border-radius overrides for all elements in the widget.
The typography
option customizes the font settings like font families.
Let's proceed with the theme and adjust the primary and secondary colors of the inner elements, along with the font family and border-radius.
The components
option allows you to customize the styles of specific components within the widget.
The current list of available components with more to come:
MuiAppBar is used as a header/navigation component at the top of the widget.
MuiAvatar is used to display token/chain avatars.
MuiButton is used for various buttons in the widget.
MuiCard is used for card elements within the widget. There are also three default card variants available for customization: outlined
, elevation
, and filled
. They can be set using defaultProps
option (see example below).
outlined - default variant where the card has thin borders.
elevation - variant where the card has a shadow.
filled - variant where the card is filled with color (palette.background.paper
property).
MuiIconButton is used for icon buttons within the widget.
MuiInputCard is used for input cards within the widget.
MuiTabs is used for tab navigation within the widget (available in split
subvariant).
With the components
option, each component can be customized using the MUI's styleOverrides
property, allowing for granular control over its styling.
Let's take a look at the example, which shows how we can use card component variants together with overriding tabs component styles.
The LI.FI Widget includes several pre-configured themes that provide a starting point for customization. These themes demonstrate various configurations of colors, shapes, and component styles, giving you an idea of how the widget can be styled to fit different design requirements.
Check out our LI.FI Playground to play with themes.
Besides the default theme, there are three pre-configured themes available with more to come.
Developers can import them directly from @lifi/widget
package.
You can further customize these pre-configured themes by modifying their properties or combining them with your own custom styles. This flexibility allows you to achieve the exact look and feel you desire for your application.
The widget has complete dark mode support out of the box. By default, the appearance
option is set to auto
, matching the user's system settings for dark and light modes.
Now, let's set the default appearance to dark.
The disabledUI
property allows you to specify which UI elements should be disabled in the widget. Disabling UI elements can be useful to prevent user interaction with certain parts of the widget that might not be necessary or desirable for your specific implementation.
The DisabledUI
enum specifies UI elements that can be disabled to prevent user interaction.
The hiddenUI
property allows you to specify which UI elements should be hidden in the widget. This is useful for tailoring the user interface to fit your specific needs by removing elements that might not be relevant for your use case.
The HiddenUI
enum specifies UI elements that can be hidden from the UI.
The following example shows how to hide appearance and language settings in the UI.
The requiredUI
property allows you to specify which UI elements should be required in the widget. This means that the user must interact with these elements for the widget to proceed with swapping/bridging. This is useful for ensuring that certain critical inputs are provided by the user.
The RequiredUI
enum specifies UI elements that are required to be filled out or interacted with by the user.
Making the destination address required can come in handy when developers want to build a flow where only a pre-configured list of wallet addresses can be set as the destination. See #configure-a-curated-list-of-wallet-addresses for more details.
If you are interested in additional customization options for your service, reach out via our Discord or Partnership page.
As you can see, widget customization is pretty straightforward. We are eager to see what combinations you will come up with as we continue to add new customization options.