Authors:Yoshiroh Kamiyama
Developers:Yoshiroh Kamiyama


dojox/mobile/Icon is a simple utility class for creating an image icon, a CSS sprite icon, or a DOM Button. It calls dojox/mobile/iconUtils.createIcon() with the appropriate parameters to create an icon. Note that this module is not a widget, that is it does not inherit from dijit/_WidgetBase.


Constructor Parameters

Parameter Type Default Description
icon String “” The icon to display. The value can be either a path for an image file or a class name of a DOM button.
iconPos String “” The position of the aggregated icon. IconPos is a comma-separated list of values (top,left,width,height) (ex. “0,0,29,29”).
alt String “” The alt text for the icon image.
tag String “div” The name of the HTML tag to create as this.domNode.


Declarative example

<div data-dojo-type="dojox/mobile/Icon"
<div data-dojo-type="dojox/mobile/Icon"
     data-dojo-props='icon:"images/tab-icons.png", iconPos:"29,116,29,29"'></div>
<div data-dojo-type="dojox/mobile/Icon"

Programmatic example

], function(ready, Icon){
    var icon1 = new Icon({icon:"images/tab-icon-23h.png"},
    var icon2 = new Icon({icon:"images/tab-icons.png", iconPos:"29,116,29,29"},
    var icon3 = new Icon({icon:"mblDomButtonBlueCircleArrow"},
<div id="icon1"></div>
<div id="icon2"></div>
<div id="icon3"></div>
Error in the documentation? Can’t find what you are looking for? Let us know!