Skip to content

Theming

Match the Glide widget to your app's design

Both useGlidePay and useGlideDeposit accept a theme object that lets you customize the widget's colors, fonts, borders, and spacing — including full light and dark mode support.

import { useGlidePay, GlideWidgetTheme } from "@paywithglide/glide-react";
 
const theme: GlideWidgetTheme = {
  colorModalBackground: "#ffffff",
  buttonPrimaryBackground: "#4f46e5",
  buttonPrimaryForeground: "#ffffff",
  buttonPrimaryBorderRadius: "9999px",
};
 
const { openGlidePay } = useGlidePay({
  app: "my-app",
  sessionId,
  theme,
});

Every property is optional and accepts standard CSS values — colors in any CSS format (#hex, rgba(...), etc.), and lengths in any CSS unit (px, rem, %).

Light and dark mode

The widget's default palette is light. It does not switch palettes automatically — to support dark mode, define a dark theme and pass it whenever your app is in dark mode.

1. Define your themes

import { GlideWidgetTheme } from "@paywithglide/glide-react";
 
export const lightTheme: GlideWidgetTheme = {
  colorScheme: "light",
 
  colorModalBackdrop: "rgba(0, 0, 0, 0.4)",
  colorModalBackground: "#ffffff",
  colorModalBorder: "#f5f5f5",
 
  colorTextPrimary: "#171717",
  colorTextSecondary: "#a3a3a3",
  colorBackgroundSecondary: "#f5f5f5",
 
  buttonPrimaryForeground: "#ffffff",
  buttonPrimaryBackground: "#262626",
  buttonSecondaryBackground: "#f5f5f5",
 
  alertBackground: "#f5f5f5",
  colorAlertBackground: "#f5f5f5",
  colorAlertAccent: "#171717",
  colorAlertWarningBackground: "#fed7aa",
  colorAlertWarningAccent: "#f97316",
};
 
export const darkTheme: GlideWidgetTheme = {
  colorScheme: "dark",
 
  colorModalBackdrop: "rgba(0, 0, 0, 0.7)",
  colorModalBackground: "#121212",
  colorModalBorder: "#333333",
 
  colorTextPrimary: "#ffffff",
  colorTextSecondary: "#b0b0b0",
  colorBackgroundSecondary: "#1e1e1e",
 
  buttonPrimaryForeground: "#121212",
  buttonPrimaryBackground: "#ffffff",
  buttonSecondaryBackground: "#222222",
  buttonSecondaryBorderColor: "#333333",
  buttonSecondaryBorderWidth: "1px",
 
  alertBackground: "#1e1e1e",
  colorAlertBackground: "#1e1e1e",
  colorAlertAccent: "#ffffff",
  colorAlertWarningBackground: "#2e1f00",
  colorAlertWarningAccent: "#f0b90b",
  colorAlertBorder: "#333333",
};

2. Pass the active theme

If your app manages its own light/dark state, use that:

const { openGlidePay } = useGlidePay({
  app: "my-app",
  sessionId,
  theme: isDarkMode ? darkTheme : lightTheme,
});

Or follow the user's system preference:

const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
 
const { openGlidePay } = useGlidePay({
  app: "my-app",
  sessionId,
  theme: prefersDark ? darkTheme : lightTheme,
});

About colorScheme

The colorScheme property sets the CSS color-scheme inside the widget, which controls how native browser UI — form inputs, scrollbars — renders. Set it to "light" or "dark" to match the palette you're passing.

If you don't set it, the SDK auto-detects it from your page's root color-scheme value. Note that this only affects native browser UI — the widget's colors always come from the theme properties, so a dark palette must be provided explicitly.

Custom fonts

Load your app's font into the widget with fontSrcCss (a URL to a CSS stylesheet that declares the font) and fontFamily:

const theme: GlideWidgetTheme = {
  fontSrcCss: "https://fonts.googleapis.com/css2?family=Manrope:[email protected]&display=swap",
  fontFamily: "Manrope, sans-serif",
};

Theme reference

General

PropertyDescriptionDefault
colorSchemeCSS color-scheme for native browser UI ("light" or "dark")Auto-detected from your page
fontSrcCssURL of a CSS stylesheet that loads your font
fontFamilyCSS font-family used throughout the widgetInter

Modal

PropertyDescriptionDefault
colorModalBackdropOverlay color behind the modal#f5f5f5
colorModalBackgroundModal surface color#ffffff
colorModalBorderModal border and divider color#f5f5f5
modalBorderWidthModal border width1px
modalBorderRadiusModal corner radius1rem

Text & surfaces

PropertyDescriptionDefault
colorTextPrimaryPrimary text color#171717
colorTextSecondarySecondary / muted text color#a3a3a3
colorBackgroundSecondaryBackground of secondary surfaces (cards, list rows)#f5f5f5

Primary button

PropertyDescriptionDefault
buttonPrimaryForegroundText color#ffffff
buttonPrimaryBackgroundBackground color#262626
buttonPrimaryBorderColorBorder colortransparent
buttonPrimaryBorderWidthBorder width0px
buttonPrimaryBorderRadiusCorner radius0.5rem
buttonPrimaryPaddingPadding (CSS shorthand)0.5rem

Secondary button

PropertyDescriptionDefault
buttonSecondaryBackgroundBackground color#f5f5f5
buttonSecondaryBorderColorBorder colortransparent
buttonSecondaryBorderWidthBorder width0px
buttonSecondaryBorderRadiusCorner radius0.375rem
buttonSecondaryPaddingPadding (CSS shorthand)0.5rem

Alerts

PropertyDescriptionDefault
alertBackgroundAlert background color#f5f5f5
alertBorderWidthAlert border width0px
colorAlertBackgroundInformational alert background#f5f5f5
colorAlertAccentInformational alert icon / accent color#171717
colorAlertWarningBackgroundWarning alert background#fed7aa
colorAlertWarningAccentWarning alert icon / accent color#f97316
colorAlertBorderAlert border colortransparent

Misc

PropertyDescriptionDefault
appLogoHeightHeight of your app's logo in the widget header2rem