This template allows a navigational template to be set up relatively quickly by supplying it one or more lists of links. It comes equipped with default styles that should work for most navigational templates. Changing the default styles is not recommended, but is possible. Using this template, or one of its "Navbox suite" sister templates, is highly recommended for standardization of navigational templates, and for ease of use.

Usage

Please remove the parameters that are left blank.

{{Navbox
|bodyclass = 
|name = {{subst:PAGENAME}}
|title = 
|titleclass = 
|image = 
|above = 

|group1 = 
|list1 = 

|group2 = 
|list2 = 
 ...
|group20 = 
|list20 = 

|below = 
}}

Parameter list

The navbox uses lowercase parameter names, as shown in the box (above). The mandatory name and title will create a one-line box if other parameters are omitted.

Notice "group1" (etc.) is optional, as are sections named "above/below". The basic and most common parameters are as follows (see below for the full list):

bodyclass = applies an HTML class attribute to the entire navbox.
name = the name of the template.
title = text in the title bar, such as: [[Widget stuff]].
titleclass = applies an HTML class attribute to the title bar.
state = autocollapse, uncollapsed, mw-collapsed: the status of box expansion, where "autocollapse" hides stacked navboxes automatically.
titlestyle = a CSS style for the title-bar, such as: background:gray;
groupstyle = a CSS style for the group-cells, such as: background:#eee;
image = an optional right-side image, coded as the whole image. Typically it is purely decorative, so it should be coded as [[File:XX.jpg|90px|link=|alt=]].
imageleft = an optional left-side image (code the same as the "image" parameter).
above = text to appear above the group/list section (could be a list of overall wikilinks).
groupn = the left-side text before list-n (if group-n omitted, list-n starts at left of box).
listn = text listing wikilinks, often separated by middots, such as: A · B (see below for more info).
below = optional text to appear below the group/list section.

Further details, and complex restrictions, are explained below under section Parameter descriptions. See some alternate navbox formats under: Layout of table.

Parameter descriptions

The following is a complete list of parameters for using Template:Navbox. In most cases, the only required parameters are name, title, and list1.

Setup parameters

name
  • the name of the template usually
state [autocollapse, collapsed, expanded, plain, off]
  • 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.
  • If set to collapsed, the navbox will always start out in a collapsed state.
  • If set to expanded, the navbox will always start out in an expanded state.
  • If set to plain, the navbox will always be expanded with no [hide] link on the right, and the title will remain centered.
  • 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.
To show the box when standalone (non-included) but then auto-hide contents when in an article, put "expanded" inside <noinclude|>...</noinclude|> tags. This setting will force the box visible when standalone (even when followed by other boxes), displaying "[hide]", but then it will auto-collapse the box when stacked inside an article:
| state = <noinclude|>expanded</noinclude|>
Often times, editors will want a default initial state for a navbox, which may be overridden in an article. Here is the trick to do this:
  • In your intermediate template, create a parameter also named "state" as a pass-through like this:
| state = {{{state<includeonly>|your_desired_initial_state</includeonly>}}}
  • The <includeonly>| will make the template expanded when viewing the template page by itself.
listn
This wikia now uses flatlist, which is an easier and better way of using the middot for lists in navboxes. See Template:Flatlist on how to use.

Technical details

  • This template uses CSS classes for most of its looks, thus it is fully skinnable.
  • Internally this meta template uses HTML markup instead of wiki markup for the table code. That is the usual way we make meta templates since wiki markup has several drawbacks. For instance it makes it harder to use parser functions and special characters in parameters.
  • For more technical details see the CSS classes in MediaWiki:common.css and the collapsible table used to hide the box in MediaWiki:common.js.

Intricacies

  • The 2px wide border between groups and lists is drawn using the border-left property of the list cell. Thus, if you wish to change the background color of the template (for example bodystyle = background:purple;), then you'll need to make the border-left-color match the background color (i.e. liststyle = border-left-color:purple;). If you wish to have a border around each list cell, then the 2px border between the list cells and group cells will disappear; you'll have to come up with your own solution.
  • The list cell width is initially set to 100%. Thus, if you wish to manually set the width of group cells, you'll need to also specify the liststyle to have width:auto. If you wish to set the group width and use images, it's up to you to figure out the CSS in the groupstyle, liststyle, imagestyle, and imageleftstyle parameters to get everything to work correctly. Example of setting group width:
groupstyle = width:10em;
liststyle = width:auto;
  • Adjacent navboxes have only a 1 pixel border between them (except in IE6, which doesn't support the necessary CSS). If you set the top or bottom margin of style/bodystyle, then this will not work.
  • The default margin-left and margin-right of the outer navbox table are set to "auto;". If you wish to use navbox as a float, you need to manually set the margin-left and margin-right values, because the auto margins interfere with the float option. For example, add the following code to use the navbox as a float:
style = width:22em;float:right;margin-left:1em;margin-right:0em;

Known bugs

If the heading of the navbox spans more than one line, the second line will be displayed to the right of center. This can be avoided by hard-coding linebreaks with <br clear=all>.

Notes

This code has been personalized for this wiki and the navbar code has been completely removed.

WikipediaLogoSmall.png
This page uses content from Wikipedia. The original article was at Template:Navbox. As with Witcher Wiki, the text of Wikipedia is available under the GNU Free Documentation License.
Community content is available under CC-BY-SA unless otherwise noted.