The GlueX Widget offers comprehensive customization options to match the application’s design and functionality requirements. The widget’s layout stays consistent, but you can modify colors, fonts, styles, disable or hide parts of the UI and more
interface WidgetThemeConfiguration = { // customize individual components components: WidgetCustomComponents; // sets the appearance - ("light" | "dark" | "auto") appearance: Appearance; // tweak the theme objects such as palette, shape, typography, components, container, colors, fonts and border-radius theme: WidgetTheme; // disables parts of the widget disabled: DisabledUIType[]; // hides parts of the widget hidden: HiddenUIType[]; // makes parts of the widget as required required: RequiredUIType[];}
Controls the widget’s overall color scheme, so it can adapt to your app’s light or dark mode or follow the user’s system preference automatically. Use this to ensure visual consistency and reduce “mode flicker” when users switch themes.
Fine tune which parts of the interface your users see or interact with. Disable input fields to guide user flows, hide non essential widgets for a cleaner look or mark critical fields as required to ensure data collection
Override the outer container’s dimensions and spacing to fit any layout fixed width/sidebar, full-page modal or embedded card. Control styling factors like height, max-height, padding, box shadow and more for a perfect visual fit
Adjust corner radii globally across cards, buttons and panels either a single radius for everything or separate values for primary (cards) and secondary (buttons) elements
Define the widget’s typographic scale font family, base font size and weight variants for regular, medium and bold text. Use your brand’s font stack for full design cohesion
Define full light and dark palettes - primary, secondary, background, text and semantic colors (success, error, warning, info) giving you end to end theming control with one config object
The GlueX Widget offers robust component customization through custom component overrides. This means you can tailor the look and feel of various elements to perfectly match your application’s design
Create your own React component that matches the expected props for the widget element you want to customizeFor example, to customize the token selector button, you might write:
Copy
// custom/token-selector.tsximport { type SelectTokenButtonProps } from "@gluex/widget";export const CustomTokenHeader: React.FC<SelectTokenButtonProps> = ({ formType, // "from" | "to" - Indicates if this is the source or destination token token, // Selected token information chain, // Selected chain information isSelected, // is token selected compact, // Whether to show compact view onClick, // Handler for when the selector is clicked}) => { return <div>{/* Your custom token header UI */}</div>;};
Simply import your custom component and include it in your widget configuration
For repetitive components, you can customize each of them individually (eg:
token selection - “from” and “to” buttons separately)
Copy
import { GlueXWidget, type WidgetConfigPartialProps } from "@gluex/widget";import { CustomTokenHeader } from "./custom/token-selector";export const Widget = () => { const config: WidgetConfigPartialProps["config"] = { integrator: "YOUR_INTEGRATOR_ID", apiKey: "YOUR_API_KEY", appearance: "light", // Add the custom components components: { // Use different components or styles for from/to SelectTokenButton: { from: CustomTokenHeader, // Custom component for "from" token to: CustomTokenHeader, // Custom component for "to" token }, }, }; return <GlueXWidget config={config} />;};
Ensure your custom component implements all required handler functions and
events. Missing handlers may cause unexpected behavior or break widget
functionality
import { type CompletedTransactionDetailsProps } from "@gluex/widget";export const CustomCompletedTransaction = ({ tokens, // From/To token information amounts, // Transaction amounts fees, // Transaction fees transaction, // Transaction details with hash and link providers, // List of providers used showRouteSection, // Whether to show route section showDetailsSection, // Whether to show details section}: CompletedTransactionDetailsProps) => { return <div>{/* Your custom completed transaction UI */}</div>;};