Document.styleSheetSets is a read-only live list of currently available style sheet set names (MDN). Names come from titled stylesheets on the page.
Read the notes below before you get or set this property. Prefer feature detection when support is limited.
Syntax
Use document.styleSheetSets. Start with this line.
JavaScript
document.styleSheetSets
Call
What it does
document.styleSheetSets
Primary signature.
Built into the browser. Read or assign document.styleSheetSets — no import required.
Library declarations
JavaScript
document.styleSheetSets
Parameters
Parameter
Description
Setter
Optional. Read-only
Modern path
Required. Own theme list + class / CSS
Return Value
Return Value
Description
*
The current value of document.styleSheetSets.
JavaScript Examples
Example 1 — List styleSheetSets
MDN-style loop — collect available set names into an array.
JavaScript
if ("styleSheetSets" in document) {
const names = [];
for (const sheet of document.styleSheetSets) {
names.push(sheet);
}
console.log(names);
} else {
console.log("API not available");
}
Expect gaps. Deprecated non-standard APIs are often incomplete.
Do not polyfill. Migrate themes instead of shimming this API.
Example 3 — Prefer a Modern Theme List
Own theme names + a class toggle — no style sheet sets required.
JavaScript
// Prefer this over styleSheetSets for new apps
const themes = ["light", "dark"];
console.log(themes.join(", "));
document.documentElement.classList.toggle("dark");
console.log(
document.documentElement.classList.contains("dark")
);
Own the list. Theme names live in your app config, not the DOM API.
Toggle a class. Put theme styles under .dark (or similar).
Standard APIs. Works everywhere without alternate stylesheet menus.
Pair with CSS. Custom properties and prefers-color-scheme complete the story.
Compatibility
Browser Support
Document.styleSheetSets is Deprecated and Non-standard (MDN). Support is incomplete — feature-detect, and do not ship new features on it.
✓ Deprecated · Non-standard
Document.styleSheetSets
Legacy live list of style sheet set names — avoid in new apps.
LegacyAvoid in new apps
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
Android WebViewSupported · Modern WebView
Full support
styleSheetSetsDeprecated
Bottom line: Safe to recognize in old code. For themes: your own name list, documentElement classes, CSS variables, prefers-color-scheme, or adoptedStyleSheets.
Frequently Asked Questions
A live list of all currently available style sheet set names on the document (MDN). Each item is a string title identifying a set.
Yes. MDN marks Document.styleSheetSets as Deprecated and Non-standard. Do not use it in new projects.
MDN Notes: enumerate document.styleSheets in order, add each sheet title that has a title, and drop duplicates using a case-sensitive comparison.
No. styleSheets returns CSSStyleSheet objects. styleSheetSets returns deduplicated string names of alternate sets derived from those sheets’ titles.
No. It is read-only (MDN). To switch sets in the legacy API, assign selectedStyleSheetSet instead.
Build a list from your own theme config, toggle a class on document.documentElement, use CSS custom properties, or adoptedStyleSheets.