Label and description

Add-ons using the techniques described in this document are considered a legacy technology in Firefox. Don't use these techniques to develop new add-ons. Use WebExtensions instead. If you maintain an add-on which uses the techniques described here, consider migrating it to use WebExtensions.

From Firefox 53 onwards, no new legacy add-ons will be accepted on addons.mozilla.org (AMO).

From Firefox 57 onwards, WebExtensions will be the only supported extension type, and Firefox will not load other types.

Even before Firefox 57, changes coming up in the Firefox platform will break many legacy extensions. These changes include multiprocess Firefox (e10s), sandboxing, and multiple content processes. Legacy extensions that are affected by these changes should migrate to WebExtensions if they can. See the "Compatibility Milestones" document for more.

A wiki page containing resources, migration paths, office hours, and more, is available to help developers transition to the new technologies.

Line breaking

Under normal conditions, a description will not break long-running text and the text may be cropped or hidden. To cause the text to wrap:

Ensure the long-running text is a text node child of <description/> or <label/> (i.e., do not specify the long-running text in the value attribute of these elements).

The default style for these XUL elements includes white-space: wrap;. This reduces all whitespace chunks (including newlines) to single spaces. Text is permitted to wrap.

<description>I am your father's brother's nephew's cousin's former roommate. What's that make us? Absolutely nothing!</description>

With white-space: pre; all whitespace, including newlines, is rendered literally. Text cannot wrap automatically but can still be achieved with <html:br/> if desired.

<description style="white-space: pre-wrap;">I am your father's brother's nephew's cousin's former roommate. What's that make us? Absolutely nothing!</description>

With white-space: pre-wrap; all whitespace is rendered literally, but text is additionally permitted to wrap at spaces.

Note: Prior to Firefox 3, it was necessary to use -moz-pre-wrap instead of -pre-wrap.  You may wish to use both for backward compatibility.
<description style="white-space: pre;">I am your father's brother's nephew's cousin's former roommate.
 What's that make us?
 Absolutely nothing!</description>

Text can also be made to wrap by inserting an <html:br/> element regardless of the CSS style, but this creates a hard-break that does not change as parent elements resize.

<description>I am your father's brother's nephew's cousin's former roommate.<html:br/>
What's that make us?<html:br/>
Absolutely nothing!</description>

Using labels as anchors

Its possible to make a label look and act like an HTML <a> tag:

<label class="text-link" href="http://whatever.com" value="click here to go to whatever"/>

"text-link" is a built-in, predefined class.

Note: if running in a XULRunner application add the following preferences to your default preferences file:
pref("network.protocol-handler.expose.http", false);
pref("network.protocol-handler.warn-external.http", false);

Change or add additional protocols (https or ftp) as needed.

Document Tags and Contributors

Tags: 
 Contributors to this page: bunnybooboo, wbamberg, Sheppy, Kray2, Chbok, MarkFinkle, Shadow101, ericjung
 Last updated by: bunnybooboo,