Description & Source Code

Macro component provides an option like template to piece together multiple ZK components and reuse them as a new component.

In this example, the includedMacro.zul page is declared as a macro component called newProduct in the demo page, which is then used as a regular ZK component.

<?component name="newProduct" macroURI="/widgets/composite/macro_component/includedMacro.zul"?>
	<newProduct />
	<separator height="30px"></separator>
		<newProduct title="Monitor" desc="The new HDMI monitor" img="/widgets/composite/macro_component/img/item1.jpg" />
		<newProduct title="Cell" desc="This is zPhone" img="/widgets/composite/macro_component/img/item2.jpg" />
<groupbox id="gb" mold="3d" width="240px" closable="false">
		.desc { 
			color: #008bb6; 
			font-weight: bold;
			font-family: Times New Roman; 
		.pic { 
			width: 100px; 
			height: 100px; 
	<caption label="${empty arg.title ? 'Product Title Template': arg.title}" />
		<label class="desc" value="${empty arg.desc ? 'This product has no descriptions.': arg.desc}" />
		<image class="pic" src="${arg.img}" />