The <label> Tag

The <label> tag creates an uneditable label component. A label may contain some combination of text, an icon, or formatted html.

Parameters

Name Description Legal Values Default
halign The horizontal alignment of the label contents when the label is placed in a container that is wider than the label contents.
  • left
  • center 
  • right

left

valign The vertical alignment of the label contents when the label is placed in a container that is taller than the label contents.
  • top
  • center 
  • bottom

center

text

The text to display. If the text is surrounded by "<html></html>" tags, the label is displayed as formatted html.

Some notes about HTML in labels:

  • XML format does not allow less-than and greater-than signs within attribute values. Therefore, all less-than or greater-than signs in your HTML code must be changed to &lt; and &gt; respectively. Similarly, the "&lt;" sequence must be changed to "&amp;lt;" to be rendered correctly. See examples below.
  • Label text normally appears on a single line. If there is not enough space to show all the text, some text will be hidden; line wrapping does not occur in normal labels. If a label contains HTML code, line wrapping WILL occur. This may cause spacing difficulties in your layout.

This attribute may contain backtick expressions .

any text

none

icon The URL of an image file to use as the label icon. This attribute may contain backtick expressions .

Valid URL to an image file

none

Also see common parameters.

Contents

none

Example

<box orientation="vert">
  <label text="This is a plain label"/>
  <label text="&lt;html&gt;This is a &lt;b&gt;formatted&lt;/b&gt; &lt;font size='16' color='red'&gt;HTML&lt;/font&gt; label. It takes extra effort to show a &amp;lt; sign!&lt;/html&gt;"/>
  <label icon="file:docs/images/is_a.gif" text="This label has an icon"/>
</box>