Skip to main content
The TypeScript SDK enables you to access and respond to user theme preferences without requiring a particular frontend framework.

Getting Started

1. Install the SDK

Install the SDK with your preferred package manager.

2. Initialize the SDK

Create an instance of the UserPreferences class.
For local development, you can use the sandbox configuration to test different theme preferences:
The sandbox prop should only be used for local development. Make sure to remove it before deploying to production. In production, theme preferences are controlled by the user through the Microapp platform.

3. Access Theme Preferences

Get the user’s current theme preference.
The theme preference is controlled by the user through the Microapp platform. Your application should respect this preference and adapt accordingly.

4. Listen to Theme Changes

The SDK provides a way to listen to updates to the user’s theme preference with the onUpdate() method:

5. Create and Apply Theme Styles

Define your theme styles in separate files and apply them based on the user’s theme preference.
You can then use these styles in your HTML: