Open main menu

UESPWiki β

Template:Navbox

Due to the sensitive nature of this template or the fact that it is used on a large number of pages, it has been semi-protected to prevent site-wide damage by vandal bots.
Editors: In order to minimize the impact on our servers, please use sandboxes to make and test changes to widely used templates before deployment.
For more information, please see this article's talk page.

Summary

This template allows a navigational template to be set up relatively quickly by supplying it with one or more lists of links. It comes equipped with default styles that should work for most navigational templates.

Parameters

Navbox
Parameter Scope Description
Main
name optional The name of the template (default: current template name). This controls the link targets for v • t • e links and should not be necessary in the vast majority of cases. To remove the links altogether, use navbar=off.
title required Text in the title bar
state optional
  • Defaults to autocollapse. A navbox with autocollapse will start out collapsed if there are two or more tables on the same page that use other collapsible tables. Otherwise, the navbox will be expanded. For the technically minded, see MediaWiki:Common.js.
  • If set to collapsed, the navbox will always start out in a collapsed state.
  • If set to plain, the navbox will always be expanded with no [hide] link on the right, and the title will remain centered (by using padding to offset the V • T • E links).
  • If set to off, the navbox will always be expanded with no [hide] link on the right, but no padding will be used to keep the title centered. This is for advanced use only; the "plain" option should suffice for most applications where the [show]/[hide] button needs to be hidden.
  • If set to anything other than autocollapse, collapsed, plain, or off (such as "uncollapsed"), the navbox will always start out in an expanded state, but have the "hide" button.
navbar optional If set to plain, the V • T • E links on the left side of the titlebar will not be displayed, and padding will be automatically used to keep the title centered. Use off to remove the V • T • E links, but not apply padding (this is for advanced use only; the "plain" option should suffice for most applications where a navbar is not desired). It is highly recommended that one not hide the navbar, in order to make it easier for users to edit the template, and to keep a standard style across pages.
border optional If set to child or subgroup, then the navbox can be used as a borderless child that fits snugly in another navbox.
Cells
groupn optional (i.e. group1, group2, etc.) If specified, text appears in a header cell displayed to the left of listn. If omitted, listn uses the full width of the table.
listn required (i.e. list1, list2, etc.) The body of the template, usually a list of links. Use {{Navbox/Line}} in order to display the links. Currently supports up to 32 list/group pairs.
image optional An image to be displayed in a cell below the title and to the right of the body (the groups/lists). For the image to display properly, the list1 parameter must be specified.
imageleft optional An image to be displayed in a cell below the title and to the left of the body (lists). For the image to display properly, the list1 parameter must be specified and no groups can be specified. It accepts the same sort of parameter that image accepts.
above optional A full-width cell displayed between the titlebar and first group/list
below optional A full-width cell displayed below the template's body
Style
style optional Specifies CSS styles to apply to the template body. The parameter bodystyle also does the exact same thing and can be used in place of this style parameter. This option should be used sparingly as it can lead to visual inconsistencies.
basestyle optional CSS styles to apply to the title, above, below, and group cells all at once. The styles are not applied to list cells.
titlestyle optional CSS styles to apply to title, most often the titlebar's background color.
groupstyle optional CSS styles to apply to the groupn cells. This option overrides any styles that are applied to the entire table.
groupnstyle optional CSS styles to apply to a specific group, in addition to any styles specified by the groupstyle parameter.
groupwidth optional A number and unit specifying a uniform width for the group cells, in cases where little content in the list cells may cause group cells to be too wide.
liststyle optional CSS styles to apply to all lists. Overruled by the oddstyle and evenstyle parameters (if specified) below.
listnstyle optional CSS styles to apply to a specific list, in addition to any styles specified by the liststyle parameter.
listpadding optional A number and unit specifying the padding in each list cell. The list cells come equipped with a default padding of 0.25em on the left and right, and 0em on the top and bottom.
oddstyle
evenstyle
optional Applies to odd/even list numbers. Overrules styles defined by liststyle. The default behavior is to add striped colors (white and gray) to odd/even rows, respectively, in order to improve readability.
evenodd optional If set to swap, then the automatic striping of even and odd rows is reversed. Normally, even rows get a light gray background for striping; when this parameter is used, the odd rows receive the gray striping instead of the even rows. Setting to even or odd sets all rows to have that striping color. Setting to off disables automatic row striping.
abovestyle
belowstyle
optional CSS styles to apply to the top cell (specified via the above parameter) and bottom cell (specified via the below parameter). Typically used to set background color or text alignment
imagestyle
imageleftstyle
optional CSS styles to apply to the cells where the image/imageleft sits.
Defaults
bodystyle background:#fdfdfd; width:100%; vertical-align:middle;
titlestyle background:#ccccff; padding-left:1em; padding-right:1em; text-align:center;
abovestyle background:#ddddff; padding-left:1em; padding-right:1em; text-align:center;
belowstyle background:#ddddff; padding-left:1em; padding-right:1em; text-align:center;
groupstyle background:#ddddff; padding-left:1em; padding-right:1em; text-align:right;
liststyle background:transparent; text-align:left/center;
oddstyle background:transparent;
evenstyle background:#f7f7f7;
Since liststyle and oddstyle are transparent, odd lists have the color of the bodystyle, which defaults to #fdfdfd (white with a hint of gray). A list defaults to text-align:left; if it has a group, if not it defaults to text-align:center;. Since only bodystyle has a vertical-align all the others inherit its vertical-align:middle;.
Advanced
aboveclass
groupclass
listclass
belowclass
optional This enables attaching a CSS class to group or list cells. The most common use for listclass is to give it the hlist class that will cause lists to render horizontally.
groupnclass optional This enables attaching a CSS Class to a specific group, if used groupclass should be omitted as that will override this.
titlegroup optional This puts a group in the title area, with the same default styles as groupn.
titlegroupstyle optional The styles for the titlegroup cell.
innerstyle optional A very advanced parameter to be used only for advanced meta-templates employing the navbox. Internally, the navbox uses an outer table to draw the border, and then an inner table for everything else (title/above/groups/lists/below/images, etc.). The style/bodystyle parameter sets the style for the outer table, which the inner table inherits, but in advanced cases (meta-templates) it may be necessary to directly set the style for the inner table. This parameter provides access to that inner table so styles can be applied.
bodyclass optional This parameter is inserted into the "class" attribute for the navbox as a whole.
titleclass optional This parameter is inserted into the "class" attribute for the navbox's title caption.