Authors:Yoshiroh Kamiyama
Developers:Yoshiroh Kamiyama


deviceTheme is a convenient utility module that automatically loads appropriate theme CSS files according to the detected user agent of the browser. See Dojo Mobile Themes for more information.

It can be enabled by simply including the dojox/mobile/deviceTheme script in your application as follows:

<script src="dojox/mobile/deviceTheme.js"></script>
<script src="dojo/dojo.js" data-dojo-config="parseOnLoad: true"></script>

Using the script tag as above is the recommended way to load the deviceTheme. Trying to load it using the AMD loader can lead to styles being applied too late, because the loading of the theme files would be performed asynchronously by the browser, so you could not assume that the loading has been completed when your widgets are initialized. However, loading deviceTheme using the script tag has the drawback that deviceTheme.js cannot be included in a build.

deviceTheme detects the user agent of the browser and loads the appropriate theme files. dojox/mobile provides five predefined themes, android, holodark, blackberry, iphone, ipad, and custom. If the iPhone device is detected, for example, deviceTheme loads the iphone theme.

You can also pass an additional query parameter string: theme={theme id} to force a specific theme through the browser URL input. The available theme ids are Android, BlackBerry, Holodark, Custom, iPhone, iPad and WindowsPhone. The theme names are case sensitive. If the given id does not match, the iphone theme is used. // automatic detection // forces android theme // forces holodark theme // forces blackberry theme // forces custom theme // forces iphone theme // forces ipad theme // forces ipad theme

To simulate a particular device from the application code, the user agent can be forced by setting dojoConfig.mblUserAgent as follows:

<script src="dojox/mobile/deviceTheme.js" data-dojo-config="mblUserAgent: 'Holodark'"></script>
<script src="dojo/dojo.js" data-dojo-config="parseOnLoad: true"></script>

Loading specific files

By default, an all-in-one theme file (e.g. themes/iphone/iphone.css) is loaded. The all-in-one theme files contain style sheets for all the dojox/mobile widgets regardless of whether they are used in your application or not.

If you want to choose what theme files to load, you can specify them via dojoConfig or data-dojo-config as shown in the following example:

<script src="dojox/mobile/deviceTheme.js"
<script src="dojo/dojo.js" data-dojo-config="parseOnLoad: true"></script>

In the case of this example, if iphone is detected, for example, the following files will be loaded:


If you want to load style sheets for your own custom widgets, you can specify a package name along with a theme file name in an array.


In this case, the following files will be loaded:


If you specify '@theme‘ as a theme file name, it will be replaced with the theme folder name (e.g. ‘iphone’). For example,


will load the following files:


Overriding the theme styles

Theme styles can be overridden in an HTML file as follows:

.mblButton {
    font-size: 16px;
Error in the documentation? Can’t find what you are looking for? Let us know!