Learn how to integrate the widget with Rainbowkit enabling users to perform swaps, bridge assets, lend, stake, zap and swidge directly within the application
GlueX Widget is fully compatible with Rainbowkit applications and requires minimal configuration for smooth integration. This guide demonstrates how to integrate the widget specifically with Rainbowkit and Next.jsDue to the nature of server side rendering (SSR) in Next and how different wallet libraries manage their connections to wallet extensions,
the widget needs to be specifically rendered on the client side. To achieve this, make use of the ‘use client’ directive, which ensures that the
widget component is only rendered in the client side environment
Wallet connection libraries (like wagmi, which the widget uses) interact
directly with browser APIs and wallet extensions. These functionalities are
only available in a client side (browser) environment. Attempting to render
them on the server during the build or request time would result in errors. By
explicitly marking components for client side rendering, we ensure
compatibility and a smooth user experience
With the Next.js App Router, components are primarily rendered on the server by default. To ensure the widget (and its dependencies like wagmi) runs exclusively on the client, you’ll utilize the "use client" directive and a small client side rendering wrapper component
The widget is highly configurable through its config prop. This allows you to tailor its behavior, default settings and connected services to match your application’s requirements. For a complete list of all available configuration options and their detailed descriptions, please refer to the widget configuration section
Beyond basic configuration, the widget offers extensive customization capabilities to ensure it seamlessly integrates with your application’s branding and design system. You can customize nearly every visual aspect of the widget. For a complete list of all available configuration, theme options, appearance and their detailed descriptions, please refer to the widget customization section
Check out GlueX’s Widget Studio to
customize and generate your custom widget configuration. It provides an
interactive interface to adjust settings and see real time previews, then
generates the corresponding config code snippet for you