Skip to content

elements.update()

Method@tryyoursize/sdk

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;
optionsElementsOptionsRequired
Properties
appearanceAppearanceOptional

Look and feel; by default the elements inherit the page's font and colours.

localeLocaleOptional
const dark = matchMedia("(prefers-color-scheme: dark)");
dark.addEventListener("change", () =>
elements.update({ appearance: { theme: "inherit" } }), // re-reads your page's colours
);

Was this page helpful?