Skip to main content
Version: 1.1.0

setTheme

setTheme(theme): void

This function changes the theme of every SAS Content SDK component on the page. Components that are already displayed update immediately, without reloading the page. Components that are added later also use the new theme. Menus, dialogs, and other popovers that are opened by the components use the same theme.

If setTheme is not called, the components use the SAS light theme.

Arguments​

theme: string | { themeId: string }​

The theme to apply.

Values​

'light'

The SAS light theme. This is the default.

'dark'

The SAS dark theme.

'high-contrast'

The SAS high-contrast theme.

{ themeId: string }

A theme from the SAS Viya platform, such as a custom theme that was created with SAS Theme Designer. The theme is requested from the SAS Viya themes service by its ID.

Example​

window.addEventListener('contentSdkComponents.loaded', function () {
// Use one of the built-in themes
window.contentSdkComponents.setTheme('dark');

// Or use a theme from the SAS Viya platform
window.contentSdkComponents.setTheme({ themeId: 'sas_ignite' });
});