Skip to content
Create account
or
Sign in
The Stripe Docs logo
/
Ask AI
Create account
Sign in
Get started
Payments
Revenue
Platforms and marketplaces
Money management
Developer resources
Overview
Get started with Connect
Integration fundamentals
Example integrations
Account management
Onboard accounts
Configure account Dashboards
    Get started with Connect embedded components
    Customise Connect embedded components
      Appearance options
      Support dark mode
    Supported Connect embedded components
    Stripe Dashboard customisation
    Platform controls for Stripe Dashboard accounts
    Express Dashboard
Work with connected account types
Payment processing
Accept payments
Pay out to accounts
Platform administration
Manage your Connect platform
Tax forms for your Connect platform
HomePlatforms and marketplacesConfigure account DashboardsCustomize Connect embedded components

Support dark mode

Learn how to support dark mode with embedded components.

If your application supports a dark mode toggle and uses Connect embedded components, ensure the UI state for your site and embedded components remain consistent.

Determine dark mode appearance properties

Use the embedded components customisation tool to determine the right tokens to support dark mode. Each website can have a slightly different dark mode theme (for example, a different background colour), so customise this depending on your app. A good starting point is our Demo dark mode theme preset.

Specify the appearance when you initialise Connect embedded components

After you obtain these values, specify them as a parameter in loadConnectAndInitialize:

index.js
import {loadConnectAndInitialize} from '@stripe/connect-js'; // The appearance variables used in dark mode const darkModeAppearanceVariables = { // Note: These properties will depend on how your application looks! colorPrimary: "#0085FF", colorText: "#C9CED8", colorBackground: "#14171D", buttonSecondaryColorBackground: "#2B3039", buttonSecondaryColorText: "#C9CED8", colorSecondaryText: "#8C99AD", actionSecondaryColorText: "#C9CED8", actionSecondaryTextDecorationColor: "#C9CED8", colorBorder: "#2B3039", colorDanger: "#F23154", badgeNeutralColorBackground: "#1B1E25", badgeNeutralColorBorder: "#2B3039", badgeNeutralColorText: "#8C99AD", badgeSuccessColorBackground: "#152207", badgeSuccessColorBorder: "#20360C", badgeSuccessColorText: "#3EAE20", badgeWarningColorBackground: "#400A00", badgeWarningColorBorder: "#5F1400", badgeWarningColorText: "#F27400", badgeDangerColorBackground: "#420320", badgeDangerColorBorder: "#61092D", badgeDangerColorText: "#F46B7D", offsetBackgroundColor: "#1B1E25", formBackgroundColor: "#14171D", overlayBackdropColor: "rgba(0,0,0,0.5)", }; const lightModeAppearanceVariables = { // These properties will depend on how your application looks! colorPrimary: "#0085FF", } const stripeConnect = await loadConnectAndInitialize({ // This is a placeholder. Replace it with with your publishable API key. // Sign in to see your own test API key embedded in code samples. // Don’t submit any personally identifiable information in requests made with this key. publishableKey:
"pk_test_TYooMQauvdEDq54NiTphI7jx"
, fetchClientSecret: fetchClientSecret, appearance: { variables: isDarkMode ? darkModeAppearanceVariables : lightModeAppearanceVariables, // You should initialize depending on your website's current UI state }, })

Update the appearance after app initialisation

If your app has a toggle to select dark and light mode, ensure that you update embedded components accordingly. To do this, use the update API:

index.js
// This code runs after you update dark or light mode stripeConnect.update({ appearance: { variables: isDarkMode ? darkModeAppearanceVariables : lightModeAppearanceVariables, // You should initialize depending on your website's current state }, });

Always update the appearance to keep Connect embedded components consistent with your current app’s UI state.

Was this page helpful?
YesNo
  • Need help? Contact Support.
  • Join our early access programme.
  • Check out our changelog.
  • Questions? Contact Sales.
  • LLM? Read llms.txt.
  • Powered by Markdoc