Panel Content Macros and Variables

Last modified by Eleni Cojocariu on 2026/08/28 09:53

Reference

The "Content" property of a Panel is rendered like any wiki page, with these Velocity macros and variables available on top of the usual ones. The macros come from macros.vm in the web templates module; wrap the body of every Panel in a header and a footer so it is given the markup, the title and the landmark role the skin expects.

Macros

MacroParametersEffect
panelheader$title, $isLarge, $isHeaderHidden, $isNavigationOpens the Panel with $title as its heading and as the Panel's accessible name, and with the complementary landmark role. The three flags default to false, and the four macros below are the combinations of them worth naming.
largepanelheader$titleAs above, plus the large CSS class for a Panel meant to fill a wide column.
panelhiddenheader$titleAs panelheader, with the heading hidden while still being announced to assistive technology.
navigationPanelHeader$titleAs panelheader, but with the navigation landmark role, for a Panel whose content is a set of links to navigate by.
largeNavigationPanelHeader$titleThe large and navigation combination.
panelfooternoneCloses whichever header was opened. Every header needs exactly one.

Writing the header and footer by hand instead of calling the macros costs the Panel its landmark role, so a screen-reader user loses the ability to jump to it:

#navigationPanelHeader('Quick links')

* [[Sandbox>>Sandbox.WebHome]]
* [[Blog>>Blog.WebHome]]

#panelfooter()

Variables

VariableTypeHolds
$paneldocDocumentThe Panel's own document. Use it to reach the Panel's attachments or xobjects.
$docDocumentThe page the Panel is being displayed on, which is what a Panel tests to decide whether to output anything.
$xwikiPanelWidthStringThe width configured for the column the Panel is in: Small, Medium or Large. It is reset to Medium outside a column, so a Panel rendered through the Display Panel Layout Macro reads that value.

A Panel that adapts to the column it sits in branches on the width rather than measuring anything:

#panelheader('Members')
#if ($xwikiPanelWidth == 'Small')
  ## avatars only
#else
  ## avatars and names
#end
#panelfooter()

FAQ

Why is my Panel's heading rendered twice?

The header macro already emits it. Remove the heading you wrote in the content yourself.

Can I call these macros outside a Panel?

They are defined for every page, but panelheader reads $paneldoc, which is only bound while a Panel renders, so the generated CSS classes are wrong anywhere else.

Is there an equivalent for a Panel written in Java?

No. A Java UIExtension returns blocks, so it builds the same markup itself or delegates to the template.

Related

Get Connected