LabelImageElement"

From Documentation
 
(25 intermediate revisions by 6 users not shown)
Line 13: Line 13:
  
 
= Preload Image =
 
= Preload Image =
since 6.0.0
+
{{versionSince| 6.0.0}}
  
 
The feature is applied to all of the LabelImageElement and Image components.
 
The feature is applied to all of the LabelImageElement and Image components.
Line 20: Line 20:
 
For example,
 
For example,
  
<source lang="xml" high="2">
+
<source lang="xml" highlight="2">
 
<button image="xxx.png">
 
<button image="xxx.png">
 
   <custom-attributes org.zkoss.zul.image.preload="true"/>
 
   <custom-attributes org.zkoss.zul.image.preload="true"/>
Line 30: Line 30:
 
For example,
 
For example,
  
<source lang="xml" high="2">
+
<source lang="xml" highlight="2">
 
<window>
 
<window>
 
   <custom-attributes org.zkoss.zul.image.preload="true"/>
 
   <custom-attributes org.zkoss.zul.image.preload="true"/>
Line 40: Line 40:
 
As you can see, the ''custom-attributes'' will be checked recursively (see also <javadoc method="getAttribute(java.lang.String,boolean)">org.zkoss.zk.ui.ext.Scope</javadoc>).
 
As you can see, the ''custom-attributes'' will be checked recursively (see also <javadoc method="getAttribute(java.lang.String,boolean)">org.zkoss.zk.ui.ext.Scope</javadoc>).
  
  [since 6.5.2]
+
{{versionSince| 6.5.2}}
The feature can also applied from zk.xml as a library properity.
+
 
 +
The feature can also applied from zk.xml as a library property.
  
 
For example,
 
For example,
Line 55: Line 56:
  
 
= IconSclass =
 
= IconSclass =
 
+
Allow you to specify built-in icon CSS classes, see [[ZK_Developer%27s_Reference/Integration/Presentation_Layer/Font_Awesome]]
[since 7.0.0]
 
 
 
ZK 7.0.0 integrate [http://fortawesome.github.io/Font-Awesome/ FontAwesome 4.0.1] with prefix z-icon. To use it, just add iconSclass attribute.
 
 
 
For example, add home icon on Button,
 
 
 
<source lang="xml" high="2">
 
<window>
 
    <button iconSclass="z-icon-home" />
 
</window>
 
</source>
 
 
 
If you want to use other Font Awesome function such as animation icon, you can include the external font awesome CSS link and add the CSS class to iconSclass too. For example,
 
 
 
<source lang="xml" high="1, 3, 4">
 
<?link href="http://netdna.bootstrapcdn.com/font-awesome/4.0.1/css/font-awesome.css" rel="stylesheet"?>
 
<window>
 
    <button iconSclass="z-icon-bell fa-spin" />
 
    <button iconSclass="z-icon-home fa-2x fa-rotate-90" />
 
</window>
 
</source>
 
 
 
[since 8.0.0]
 
 
 
ZK 8.0.0 upgrade Font Awesome version to 4.3.0. Also, there is no need to include external font awesome CSS link to use animation icon, therefore the example above would be
 
 
 
<source lang="xml" high="2, 3">
 
<window>
 
    <button iconSclass="z-icon-bell z-icon-spin" />
 
    <button iconSclass="z-icon-home z-icon-2x z-icon-rotate-90" />
 
</window>
 
</source>
 
 
 
Other than using Font Awesome, you can also use iconSclass to use you own icon, for example,
 
 
 
<source lang="xml" high="2">
 
<zk>
 
    <style>
 
    .my-icon {
 
        background-image: url('path/to/icon.png');
 
    }
 
    <style>
 
    <window>
 
        <button iconSclass="my-icon" />
 
    </window>
 
</zk>
 
</source>
 
 
 
=Example=
 
 
 
N/A
 
 
 
  
 
=Supported Events=
 
=Supported Events=
  
{| border="1" | width="100%"
 
! <center>Name</center>
 
! <center>Event Type</center>
 
|-
 
| None
 
| None
 
|}
 
 
*Inherited Supported Events: [[ZK_Component_Reference/Base_Components/LabelElement#Supported_Events | LabelElement]]
 
*Inherited Supported Events: [[ZK_Component_Reference/Base_Components/LabelElement#Supported_Events | LabelElement]]
  
Line 126: Line 68:
  
  
{| border='1px' | width="100%"
+
{| class='wikitable' | width="100%"
 
! Version !! Date !! Content
 
! Version !! Date !! Content
 +
|-
 +
| 8.6.2
 +
| May 2019
 +
| [https://tracker.zkoss.org/browse/ZK-4243 ZK-4243: The result of hflex="min" is not sufficient if the content has Font Awesome icons]
 
|-
 
|-
 
| 7.0.0
 
| 7.0.0
Line 135: Line 81:
 
| 6.0.0
 
| 6.0.0
 
| September 2011
 
| September 2011
| [http://tracker.zkoss.org/browse/ZK-314 A way to pre-load images since many UIs depend on the size of an image ]
+
| [http://tracker.zkoss.org/browse/ZK-314 ZK-314: A way to pre-load images since many UIs depend on the size of an image ]
 +
|-
 +
| 10.0.0
 +
| August 2023
 +
| [http://tracker.zkoss.org/browse/ZK-5502 ZK-5502: Allow users to customize tooltip on the icon ]
 +
|-
 +
| 10.0.0
 +
| August 2023
 +
| [http://tracker.zkoss.org/browse/ZK-5503 ZK-5503: Allow users to set multiple icons and tooltips on the same LabelImageElement ]
 +
|-
 +
| 10.0.0
 +
| September 2023
 +
| [http://tracker.zkoss.org/browse/ZK-5119 ZK-5119: Integrate Font Awesome 6 free icons ]
 
|}
 
|}
  
  
 
{{ZKComponentReferencePageFooter}}
 
{{ZKComponentReferencePageFooter}}

Latest revision as of 07:50, 6 March 2024


LabelImageElement


Label Image Element

Employment/Purpose

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"/>
</button>

Or specify it just below the root component.

For example,

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

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 property.

For example,

<!-- zk.xml -->
<zk>
    <library-property>
        <name>org.zkoss.zul.image.preload</name>
        <value>true</value>
    </library-property>
</zk>

IconSclass

Allow you to specify built-in icon CSS classes, see ZK_Developer's_Reference/Integration/Presentation_Layer/Font_Awesome

Supported Events

Supported Children

*All

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 ZK-314: A way to pre-load images since many UIs depend on the size of an image
10.0.0 August 2023 ZK-5502: Allow users to customize tooltip on the icon
10.0.0 August 2023 ZK-5503: Allow users to set multiple icons and tooltips on the same LabelImageElement
10.0.0 September 2023 ZK-5119: Integrate Font Awesome 6 free icons



Last Update : 2024/03/06

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