New in 1.26.0

uiContext()

Provides styling information about the environment in which a custom component is rendered.

Custom components can show up either on a sidebar panel or in properties dialogs. Both use individual themes, dark and light respectively. Using Scrivito.uiContext(), custom components can adapt their styles to their respective environment.

Returns

null if the user interface is not present or is being loaded, otherwise UiContext (Object) – the styling information for the elements in which a custom component gets rendered, consisting of:

  • theme (String) – dark or light

Example

Add a specific class name to a custom component depending on the theme: