From Documentation


Label Image Element


An HTML element with a label and an image.

Preload Image

Since 6.0.0

The feature is applied to all of the LabelImageElement and Image components.

By default the preload function is disabled, so users have to specify the custom-attributes and set it to true. For example,

<button image="xxx.png">
  <custom-attributes org.zkoss.zul.image.preload="true"/>

Or specify it just below the root component.

For example,

  <custom-attributes org.zkoss.zul.image.preload="true"/>
  <button image="xxx.png"/>
  <image src="xxx.png"/>

As you can see, the custom-attributes will be checked recursively (see also Scope.getAttribute(String, boolean)).

Since 6.5.2

The feature can also applied from zk.xml as a library properity.

For example,

<!-- zk.xml -->


Font Awesome Bundled

Since 7.0.0

ZK 7.0.0 integrates Font Awesome 4.0.1 with the prefix z-icon. To use it, just specify the iconSclass attribute. For a complete list of icons, please refer to FontAwesome Cheatsheet.

For example, to add a home icon on a Button,

    <button iconSclass="z-icon-home" />

If you want to use other Font Awesome function such as the animation icon, you can include the external font awesome CSS link and add the CSS class to iconSclass. For example,

<?link href="" rel="stylesheet"?>
    <button iconSclass="z-icon-bell fa-spin" />
    <button iconSclass="z-icon-home fa-2x fa-rotate-90" />

Since 8.0.0

ZK 8.0.0 integrates Font Awesome 4.3.0. Also, with ZK 8 there is no need to include external font awesome CSS link to use an animation icon. Therefore the example above becomes

    <button iconSclass="z-icon-bell z-icon-spin" />
    <button iconSclass="z-icon-home z-icon-2x z-icon-rotate-90" />

Since 8.5.2

ZK 8.5.2 integrates Font Awesome 4.7.0.

Use Other Icons

The iconSclass not only applies to font awesome icons ("z-icon-" classes): Any css class can be applied to customize. Notice you need to manually include related CSS or font file. For example, the bootstrap glyphicons can be used here too:

    <button iconSclass="glyphicon glyphicon-envelope" />

Since the web font is loaded after the character is being displayed if there is no cache, ZK doesn't know if the web font is ready when initializing. Therefore using hflex="min" with iconSclass may not get the desired result. Moreover, the final width of icons might not be the same. To make the width of icons always be fixed, add z-icon-fw.

<window hflex="min">
    <button iconSclass="z-icon-fw z-icon-home" />
    <button iconSclass="z-icon-fw z-icon-bell z-icon-spin" />

Supported Events

Event Type
None None

Supported Children


Version History

Version Date Content
8.6.2 May 2019 ZK-4243: The result of hflex="min" is not sufficient if the content has Font Awesome icons
7.0.0 October 2012 Add iconSclass attribute with FontAwesome supported.
6.0.0 September 2011 A way to pre-load images since many UIs depend on the size of an image

Last Update : 2022/01/18

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.