Template:Navbox/doc

This template is used to build navboxes. It is highly recommended to use this template only for building other templates, instead of using it on pages directly.

Template originally taken from the Layton Wiki (with small modifications).

CSS styles are defined at:
 * MediaWiki:Custom-common.less/navbox.less

Features

 * Supports up to unlimited rows
 * Hides rows without a value
 * Supports image (right) and left image
 * Supports subheaders
 * Subheaders are automatically hidden if they have no rows under them (can be overridden per header)
 * Subheaders can be collapsed (configurable per header or globally)
 * Supports custom styles and classes.
 * Alternating row styles (can be disabled)
 * Can be run from wikicode (#invoke) or directly in a Module via "require"

Parameters
Here is a list of all supported parameters. All parameters are optional.
 * (n) should be replaced by any valid number.
 * Underlined values are defaults.

Main Parameters

 * template/name
 * Name of the template, used for VDE (view/discuss/edit) links.


 * border/unnamed parameter 1
 * Can be used to control the border of the navbox. Currently only supports the value "child", making the navbox a child navbox of another one.


 * title
 * The main title of the box.


 * above
 * Used to add a row that appears above all image, header and data rows.


 * header(n)
 * Used to add subheaders to the navbox. Headers are hidden by default unless there are any list rows under them.


 * show(n) = yes/no
 * Use this parameter to force show/hide a section. The number should correspond to the number of the header that started the section.


 * showall = yes
 * Use this to force show all sections. Can be overridden with individual  parameters.


 * group(n)
 * Contains the group label for a row. If not present, the corresponding list will expand to fill the gap.


 * list(n)
 * The actual list for the row.


 * below
 * Used to add a row that appears below all header and data rows.

Images
The navbox supports 2 images (one left and one right). Both images support full syntax and filename. In case of the former, the respective width and link parameters will be ignored.


 * image
 * Specify an image for the right side


 * imagewidth = 100px
 * If you didn't use the full syntax, use this to specify the width of the image


 * imagelink
 * You can use this to link the image to a certain page.


 * imageleft
 * Specify an image for the left side


 * imageleftwidth = 100px
 * Width for the left image


 * imageleftlink
 * Link for the left image

Style Parameters

 * alternaterows = yes /no/swap
 * You can optionally add this to disable alternating row styles. If set to, the odd rows will be the alternate rows; otherwise the even rows are.


 * bodystyle
 * bodyclass
 * Classes and styles to add to the infobox itself


 * titlestyle
 * titleclass
 * Classes and styles to add to the title


 * abovestyle
 * aboveclass
 * Classes and styles to add to the above row


 * imagestyle
 * imageclass
 * Classes and styles to add to the image


 * imageleftstyle
 * imageleftclass
 * Classes and styles to add to the left image


 * rowclass
 * Classes to add to all list rows


 * altrowclass = alt
 * Classes to add to list rows with alternating styles


 * groupstyle
 * groupclass
 * Classes and styles to add to the groups


 * altgroupstyle
 * altgroupclass
 * Classes and styles to add to the groups in alternate rows (if enabled)


 * liststyle
 * listclass
 * Classes and styles to add to the lists


 * altliststyle
 * altlistclass
 * Classes and styles to add to the lists in alternate rows (if enabled)


 * belowstyle
 * belowclass
 * Classes and styles to add to the below row

Collapsing
The Navbox supports two forms of collapsing: for the navbox itself and for individual subsections.


 * state = collapsed/ expanded /plain
 * This parameter controls the collapsing of the navbox itself. If set to, the box will be collapsed by default. If set to  , the box can be collapsed, but will be open by default. If set to  , the box can not be collapsed and no Show/Hide link will show.


 * state(n) = collapsed/expanded/plain
 * Used to control the collapsing of a single section. A section goes from one header to the next. The number should thus correspond to the one of the header that is above the section to collapse. Options are the same as above.


 * defaultstate = collapsed/expanded/ plain
 * Sets the default collapse state for the subsections only. Can still be overridden by individual  parameters.

Custom Styles Example
Example using wikipedia style colors. The values represent CSS classes.

Note: It is recommended to use the classes over the styles if possible. To view/edit the default styles, see MediaWiki:Common.css