Box Macro

Last modified by Admin on 2025/02/27 00:23

cogRender wiki content in a graphical box which can contain a title and an image
TypeJAR
Category
Developed by

XWiki Development Team

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1
Bundled With

XWiki Standard

Success

Installable with the Extension Manager

Description

Usage

See example below

Parameters definition

NameOptionalAllowed valuesDefault valueDescription
cssClassyesa stringnoneA custom HTML class parameter value to use when rendering the Box. The XHTML renderer for example uses it on the surrounding SPAN (in case the box is used inline) or on the surrounding DIV (in case the box is used standalone). This allows you to provide CSS to style the box according to your needs. Example: cssClass="mybox".
titleyesa stringnoneThe title which is to be displayed in the message box (ordinary text or Wiki 2.0 syntax). XWiki 16.7+ The title is now bold by default.
imageyesa stringnoneThe image which is to be displayed in the message box (absolute URL)
widthyesa stringnoneThe width of the box, the supported format is the one defined by CSS width attribute

Example

{{box title="==Quick breakfast== " image="http://farm4.static.flickr.com/3260/2894738978_ca0d3afd07_t_d.jpg"}}
* cheese
* omelet
* milk
{{/box}}

Result

breakfast.png

Messages

The message macro and all its descendants (Info, Success, Warning, Error) rely on this macro.

Parameters definition

All the parameters from the box macro are used by the message macro. In addition to those, the message macros also support:

NameOptionalAllowed valuesDefault valueDescription
statusyesbooleanfalseXWiki 17.1.0-+  Use this if your message is generated dynamically or contains information about the current status of a process. E.g. after form submission, your message provides feedback to the user about the status of their request. This will make sure even assistive technology users are notified of the content of your message. 

XWiki 16.7+  All the message macros now contain a different icon and a style that is a bit more polished than a default box.
messageMacrosComparison.png

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager).

You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.

Dependencies

Dependencies for this extension (org.xwiki.rendering:xwiki-rendering-macro-box 17.1.0):

Get Connected