Description of icon
Flex UI
API Reference

ThemeProvider

Provides a theme for rest to the UI by rendering MuiThemeProvider and Emotion's ThemeProvider. Merges theme specified in configuration colorTheme property with overrides from configuration themeOverride property.


setProviders(Providers) => void#

Introducing a new API Flex.setProviders() which can be used to load providers on the root level once and don’t have to worry about wrapping again as the context will correctly set. Now to use Paste in Flex plugins, developers will not need to wrap Paste ThemeProvider over all its components. When using Paste, developers need to pass the CustomizationProvider from Paste to Flex using Flex.setProviders api as below. By doing this, we’ll wrap Flex with the passed Provider and developers don’t have to worry about fetching the right theme and passing it on.

Parameters:

  • Providers: ProvidersProps

    A custom provider

    • PasteThemeProvider?: CustomizationProvider - Paste theme provider
    • CustomProvider?: ComponentWrapper.<RootContainerChildrenProps> - Custom provider component
      • identity?: string - Identity of the current agent.
      • currentLoginState?: string - State of the login [UNKNOWN, LOGGING_IN, LOGGED_IN, LOGGED_OUT, ERROR].
      • config: Config - Default configuration of flex.
      • singleSessionGuard?: SingleSessionGuardState - State of the single session guard.

Returns:

  • void

Example:

Flex.setProviders({
CustomProvider: (RootComponent) => (props) => {
return (
<Context.Provider value={{ test: "123" }}>
<RootComponent {...props} />
</Context.Provider>
);
}
});
Flex.AgentDesktopView.Panel1.Content.add(
<Context.Consumer>
{(value) => {
<div>{value.foo}</div> // Will print 123
}}
</Context.Consumer>
);

Need some help?