For a complete working example, check out our full Next.js example
repository
Why client side rendering?
Why client side rendering?
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
Prerequisites
Before proceeding with next.js specific integration, ensure you have completed the general installation steps outlined in the General InstallationIntegration - App Router
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
First, create a Widget.tsx
file (or a similar descriptive name) within your components directory. This component will encapsulate the GlueX widget and ensure it renders only on the client side
app/page.tsx
Integration - Pages Router
If you are using the traditional Pages Router, you need to use the dynamic import feature withssr: false
to import the widget dynamically
pages/index.tsx
Configuration
The widget is highly configurable through itsconfig
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
Customization
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 sectionCheck 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