Template:Navbox
This template employs some extremely complicated or esoteric features of template syntax. |
{{Navbox}} allows a navigational template to be set up relatively quickly by supplying it with one or more lists of links. Using this template or {{Navbox with collapsible groups}} is highly recommended for standardization of navigational templates, and for ease of use.
Usage
Please remove the parameters that are left blank.
{{Navbox | name = {{subst:PAGENAME}} | title = | image = | above = | group1 = | list1 = ... | group20 = | list20 = | below = }}
Parameter list
The navbox uses lowercase parameter names, as shown in the box (at right). 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):
name -
the name of the template.title -
text in the title bar, such as: [[Widget stuff]].state - off, uncollapsed (default), collapsed
: the status of box expansion, where "off" hides collapser completely.
groupBackground -
a CSS color for the group-cells, such as:#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=]]
.
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 middot templates, such as: [[A]]{{·}}
[[B]]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 section Layout of table.
Parameter descriptions
The following is a complete list of parameters for using {{Navbox}}. In most cases, the only required parameters are name
, title
, and list1
, though child navboxes do not even require those to be set.
{{Navbox}} shares numerous common parameter names as its sister template {{Navbox with collapsible groups}} for consistency and ease of use. Parameters marked with an asterisk * are common to all templates.
Setup parameters
- name*
- The name of the template, which is needed for the view, discuss, and edit icon links to work properly on all pages where the template is used. You can enter
{{subst:PAGENAME}}
for this value as a shortcut. The name parameter is only mandatory if atitle
is specified and theborder
parameter is not set.
- state* [
uncollapsed, collapsed, off
] -
- Defaults to
uncollapsed
. - If set to
collapsed
, the navbox will always start out in a collapsed state. - If set to
off
, the navbox will always be expanded with no [hide] link on the right. - If set to anything other than
collapsed
, oroff
(such asuncollapsed
), the navbox will always start out in an expanded state, but have the "hide" button.
- Defaults to
- To define a default initial state for a navbox that can be overridden in an article:
- In your intermediate template, create a parameter also named "state" as a pass-through:
- | state = {{{state<includeonly>|your_desired_initial_state</includeonly>}}}
- The <includeonly>| will expand the template when viewing the template page by itself.
- Example: {{Absalom navbox}} with autocollapse as the default initial state. The Docks transcludes it and has only one navbox, so the Absalom navbox shows. Absalom has two navboxes, so the Absalom navbox collapses.
Cells
- title*
- Text that appears centered in the top row of the table. It is usually the template's topic, i.e. a succinct description of the body contents. This should be a single line, but if a second line is needed, use
·
to ensure proper centering. This parameter is technically not mandatory, but using {{Navbox}} is rather pointless without a title.
- groupn*
- (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.
- groupBackground*
- If specified, changes the background color of the groups of this Navbox and all contained Navboxes.
- groupColor*
- If specified, changes the text color of the groups of this Navbox and all contained Navboxes.
- listn*
- (i.e. list1, list2, etc.) The body of the template, usually a bulleted list of links. Format is inline, although the text can be entered on separate lines if the entire list is enclosed within
<div> </div>
. At least one list parameter is required; each additional list is displayed in a separate row of the table. Each listn may be preceded by a corresponding groupn parameter, if provided (see below).
- image*
- 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. The image parameter accepts standard wikicode for displaying an image, e.g.:
[[File:XX.jpg|90px|link=|alt=]]
- above*
- A full-width cell displayed between the titlebar and first group/list, i.e. above the template's body (groups, lists and image). In a template without an image, above behaves in the same way as the list1 parameter without the group1 parameter.
- below*
- A full-width cell displayed below the template's body (groups, lists and image). In a template without an image, below behaves in the same way as the template's final listn parameter without a groupn parameter.
Layout of table
Table generated by {{Navbox}} without image, above, and below parameters (gray list background color added for illustration only):
Table generated by {{Navbox}} with image, above and below parameters (gray list background color added for illustration only):
Table generated by {{Navbox}} with image, lists, and without groups, above, below (gray list background color added for illustration only):
Examples
No image
{{Navbox | name = Thassilon navbox | title = The Seven Realms of [[Thassilon]] | image = | list1 = * [[Bakrakhan]], realm of Wrath * [[Cyrusian]], realm of Pride * [[Edasseril]], realm of Envy * [[Eurythnia]], realm of Lust * [[Gastash]], realm of Gluttony * [[Haruka]], realm of Sloth * [[Shalast]], realm of Greed }}
With image, without groups
{{Navbox | name = Thassilon navbox | title = The Seven Realms of [[Thassilon]] | image = [[File:Sihedron Rune.jpg|75px|The Sihedron Rune]] | list1 = * [[Bakrakhan]], realm of Wrath * [[Cyrusian]], realm of Pride * [[Edasseril]], realm of Envy * [[Eurythnia]], realm of Lust * [[Gastash]], realm of Gluttony * [[Haruka]], realm of Sloth * [[Shalast]], realm of Greed }}
With image, groups, above, below
{{Navbox | name = Thassilon navbox | title = The Seven Realms of [[Thassilon]] | image = [[File:Sihedron Rune.jpg|75px|The Sihedron Rune]] | above = Listed with their associated sin | group1 = Wrath | list1 = * [[Bakrakhan]] | group2 = Pride | list2 = * [[Cyrusian]] | group3 = Envy | list3 = * [[Edasseril]] | group4 = Lust | list4 = * [[Eurythnia]] | group5 = Gluttony | list5 = * [[Gastash]] | group6 = Sloth | list6 = * [[Haruka]] | group7 = Greed | list7 = * [[Shalast]] | below = '''See also''': [[Runelords]] }}
It is possible to place multiple navboxes within a single border with the use of the border parameter, or by specifying the first parameter to be "child". The basic code for doing this is as follows (which adds a subgroup for the first group/list area):
{{Navbox | name = {{subst:PAGENAME}} | title = Title | group1 = [optional] | list1 = {{Navbox ...child navbox parameters... }} ... }}
You can nest several levels of navbox to add subgroups to a group:
{{Navbox | name = {{subst:PAGENAME}} | title = Title | group1 = [primary] | list1 = {{Navbox | group1 = [secondary] | list1 = {{Navbox | group1 = [tertiary] | list1 = ... }} ... }} ... }}
Multiple show/hides in a single container
Use {{Navbox with collapsible groups}}.
This navbox template is specifically designed to work in conjunction with {{Navbox with collapsible groups}}. Both templates share common parameters for consistency and ease of use (such parameters are marked with a † in the complete parameter list above). Most importantly, all of these templates can each be used as children of one another.
{{Navbox}} 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. Using this template, or one of its "Navbox suite" sister templates, is highly recommended for standardization of navigational templates, and for ease of use.
Parameter | Description | Type | Status | |
---|---|---|---|---|
name | name | This has to contain the page name of the template box itself
| Page name | required |
title | title | A title shown in bold at the top of the box.
| Content | suggested |
state | state | Allows to disable the collapse button or to collapse as a default state.
| String | optional |
above | above | Shown above the Groups | Content | optional |
image | image | Shown right of the lists. | Content | optional |
groupBackground | groupBackground | Any css color given will color the group column in the box accordingly.
| String | optional |
groupColor | groupColor | Any css color given will color the text in the group column in the box accordingly.
| String | optional |
group1 | group1 | no description | Unknown | suggested |
list1 | list1 | no description | Content | required |
group2 | group2 | no description | Content | optional |
list2 | list2 | no description | Content | optional |
below | below | Shown below the lists. | Content | optional |