setConfig() method.
Signature
Parameters
If
true, returns only the content-related configuration (code, languages, title, description, etc.) without user preferences like theme, editor settings, or formatter options.Returns
A promise that resolves to a Config object representing the playground state.The Config object includes:
markup,style,script- Editor configurations with language and contenttitleanddescription- Project metadatatags- Project tags for categorizationactiveEditor- Currently active editorlanguages- List of enabled languagesstylesheetsandscripts- External resourcesprocessors- Enabled CSS processorscustomSettings- Language-specific custom settingsimports- Custom import mapstypes- Custom TypeScript types- User preferences (theme, editor settings, etc.) unless
contentOnlyistrue
Usage
Get Full Configuration
Get Content-Only Configuration
Save and Restore Playground State
Clone Configuration to Another Playground
Export Project Data
Notes
- The returned configuration object is a deep copy and can be safely modified.
- If the playground is not yet loaded, calling this method will load it first.
- Use
contentOnly: truewhen you want to share or export project content without user-specific settings. - The configuration object can be quite large for projects with lots of code.
Related Methods
setConfig()- Load a new configurationgetCode()- Get code content and compiled outputgetShareUrl()- Generate a shareable URL