namespace sap.ui.core.theming.Parameters

Visiblity: public
Available since: N/A
Module: sap/ui/core/theming/Parameters
Application Component: CA-UI5-COR

A helper used for (read-only) access to CSS parameters at runtime.


Nodes Overview

Node Description

Methods Overview

Method Description
sap.ui.core.theming.Parameters._getScopes

Returns the scopes from current theming parameters.

sap.ui.core.theming.Parameters.get

Returns the current value for one or more theming parameters, depending on the given arguments. The synchronous usage of this API has been deprecated and only the asynchronous usage should still be used (see the 4th bullet point and the code examples below).

The theming parameters are immutable and cannot be changed at runtime. Multiple Parameters.get() API calls for the same parameter name will always result in the same parameter value.

The following API variants are available (see also the below examples):

  • (deprecated since 1.92) If no parameter is given a key-value map containing all parameters is returned
  • (deprecated since 1.94) If a string is given as first parameter the value is returned as a string
  • (deprecated since 1.94) If an array is given as first parameter a key-value map containing all parameters from the array is returned
  • If an object is given as first parameter the result is returned immediately in case all parameters are loaded and available or within the callback in case not all CSS files are already loaded. This is the only asynchronous API variant. This variant is the preferred way to retrieve theming parameters. The structure of the return value is the same as listed above depending on the type of the name property within the object.

The returned key-value maps are a copy so changing values in the map does not have any effect

Please see the examples below for a detailed guide on how to use the asynchronous variant of the API.

sap.ui.core.theming.Parameters.getActiveScopesFor

Returns the active scope(s) for a given control by looking up the hierarchy.

The lookup navigates the DOM hierarchy if it's available. Otherwise if controls aren't rendered yet, it navigates the control hierarchy. By navigating the control hierarchy, inner-html elements with the respective scope classes can't get recognized as the Custom Style Class API does only for root elements.

sap.ui.core.theming.Parameters.reset

Resets the CSS parameters which finally will reload the parameters the next time they are queried via the method get.

sap.ui.core.theming.Parameters._getScopes

Returns the scopes from current theming parameters.

Param Type DefaultValue Description
bAvoidLoading boolean

Whether loading of parameters should be avoided

bAsync boolean

Whether loading of parameters should be asynchronous

sap.ui.core.theming.Parameters.get

Returns the current value for one or more theming parameters, depending on the given arguments. The synchronous usage of this API has been deprecated and only the asynchronous usage should still be used (see the 4th bullet point and the code examples below).

The theming parameters are immutable and cannot be changed at runtime. Multiple Parameters.get() API calls for the same parameter name will always result in the same parameter value.

The following API variants are available (see also the below examples):

The returned key-value maps are a copy so changing values in the map does not have any effect

Please see the examples below for a detailed guide on how to use the asynchronous variant of the API.

Param Type DefaultValue Description
vName string string[] object

the (array with) CSS parameter name(s) or an object containing the (array with) CSS parameter name(s), the scopeElement and a callback for async retrieval of parameters.

name string string[]

the (array with) CSS parameter name(s)

scopeElement sap.ui.core.Element

Element / control instance to take into account when looking for a parameter value. This can make a difference when a parameter value is overridden in a theme scope set via a CSS class.

callback function

If given, the callback is only executed in case there are still parameters pending and one or more of the requested parameters is missing.

oElement sap.ui.core.Element

Element / control instance to take into account when looking for a parameter value. This can make a difference when a parameter value is overridden in a theme scope set via a CSS class.

sap.ui.core.theming.Parameters.getActiveScopesFor

Returns the active scope(s) for a given control by looking up the hierarchy.

The lookup navigates the DOM hierarchy if it's available. Otherwise if controls aren't rendered yet, it navigates the control hierarchy. By navigating the control hierarchy, inner-html elements with the respective scope classes can't get recognized as the Custom Style Class API does only for root elements.

Param Type DefaultValue Description
oElement object

element/control instance

bAsync boolean

Whether the scope should be retrieved asynchronous

sap.ui.core.theming.Parameters.reset

Resets the CSS parameters which finally will reload the parameters the next time they are queried via the method get.

Param Type DefaultValue Description