elements.update()
Live update, e.g. when the shop switches to dark mode.
Mounted elements and an open window restyle at once; nothing reloads.
update(options: ElementsOptions): void;Parameters
Section titled “Parameters”optionsElementsOptionsRequiredProperties
appearanceAppearanceOptionalLook and feel; by default the elements inherit the page's font and colours.
localeLocaleOptionalExamples
Section titled “Examples”Follow your dark mode
Section titled “Follow your dark mode”const dark = matchMedia("(prefers-color-scheme: dark)");dark.addEventListener("change", () => elements.update({ appearance: { theme: "inherit" } }), // re-reads your page's colours);// The provider calls elements.update() when options.appearance changes.<TryYourSizeProvider publishableKey="pk_test_…" options={{ appearance: dark ? darkAppearance : lightAppearance }}>See also
Section titled “See also”Was this page helpful?
Thank you. We read every answer.