Dark Mode

Keep the widget in sync with your app's theme or force a static color scheme when needed.

Last reviewed

Dark Mode

The widget can follow your app automatically or use a fixed color scheme.

Default behavior

For SDK installs, the widget watches class and data-theme on both html and body.

  • dark enables dark mode
  • light enables light mode
  • system follows prefers-color-scheme

If nothing is detected, it falls back to light.

Force a static scheme

const client = createClient({
  apiKey: "YOUR_API_KEY",
  colorScheme: "dark",
});

Update at runtime

client.configure({
  colorScheme: "system",
});

To switch back to host-driven detection:

client.configure({
  colorScheme: {
    autoDetectColorScheme: ["class", "data-theme"],
  },
});

Hosted embeds

For embeds, prefer the path-based color scheme:

  • /embed/YOUR_API_KEY/SURVEY_ID/light
  • /embed/YOUR_API_KEY/SURVEY_ID/dark
  • /embed/YOUR_API_KEY/SURVEY_ID/system