The editors' meeting has been canceled for technical reasons.

Template:Navbox/doc

From NeuroWiki
Jump to navigation Jump to search


This template allows for relatively convenient and quick summarization of similar types of entries to create a navigation template (referred to here as Category:Navbox templates).

This template is highly customizable and can be used in combination with {{Navbox subgroup}}, {{Navbox with columns}}, and {{Navbox with collapsible groups}}.

Common Parameters

name
The name of the template (the part after "Template:", not the title of the template), e.g., "Attributes".
title
The text in the title bar, e.g., "AttributesList of attributes". It does not have to match name.
state
[mw-uncollapsed, mw-collapsed]
The initial collapse state of the box.
titlestyle, groupstyle, evenstyle
CSS styles for the title bar, groups, and even-numbered lists (default light green), respectively, e.g., background:gray.
above
Content displayed above the group/list section.
groupn
The text on the left, appearing before listn (if groupn is omitted, listn starts at the left edge of the box).
listn
Text listing wiki links, typically separated by bullet points, e.g., [[A]] • [[B]] • ….
below
Optional text displayed below the group/list section.
Source code with common parameters, which can be copied for quick creation of a navigation template

Remove unused parameters; do not retain them unnecessarily.

{{Navbox
|name  = {{subst:PAGENAME}}
|title = 
|state = 
|titlestyle= background:
|groupstyle= background:
|evenstyle = background:

|above = 

|group1= 
|list1 = [[]] • <!--
      -->[[]]

|group2= 
|list2 = [[]] • <!--
      -->[[]]

|group3= 
|list3 = [[]] • <!--
      -->[[]]

|group4= 
|list4 = [[]] • <!--
      -->[[]]

|group5= 
|list5 = [[]] • <!--
      -->[[]]

|group6= 
|list6 = [[]] • <!--
      -->[[]]

|below = 
}}

Most other parameters for Navbox are not commonly used, so two simplified templates have been created for the most common parameters: {{Navbox family}} and {{Navbox family row}} ({{Links}}).

Examples of some commonly used parameters can be found under #Layout of the table and #Examples. Detailed explanations and complex constraints are provided in the #Parameter descriptions section below.

Parameter Descriptions

Template:FromOther Below is a complete list of parameters for {{Navbox}}. In most cases, only the name, title, and list1 parameters are needed, though sub-navboxes may not require even these.

{{Navbox}} shares many common parameters with its sister templates {{Navbox with columns}} and {{Navbox with collapsible groups}} to enhance consistency and usability. Parameters marked with a "" are applicable to all three main templates.

Configuration Parameters

name
The name of the template. To ensure the "view • talk • edit" links work correctly on all pages using the template, this parameter needs to be set. You can use {{subst:PAGENAME}} as the value for this parameter as a shortcut. This parameter is required.
state
[mw-uncollapsed, mw-collapsed, plain, off]
  • If set to mw-collapsed, the navbox will always appear collapsed by default.
  • If set to plain, the navbox will always be expanded without a "hide" link on the right, with the title centered (via padding to offset the "view • talk • edit" links).
  • If set to off, the navbox will always be expanded without a "hide" link, but no padding will be applied to center the title. This option is for advanced use; the "plain" option should suffice for most cases where the "show"/"hide" buttons need to be removed.
  • For any other value (e.g., "mw-uncollapsed"), the navbox will always appear expanded by default, with a "hide" button.

Style Parameters

style
Specifies CSS styles applied to the main body of the template. The bodystyle parameter achieves the same effect as this style parameter and can be used as a substitute. This option should be used with caution as it may cause visual inconsistencies. Examples:
  • style = background:#nnnnnn;
  • style = width:N [em/%/px or width:auto];
  • style = float:[left/right/none];
  • style = clear:[right/left/both/none];
titlestyle
CSS styles applied to the title, often used to customize the background color of the navigation bar:
  • titlestyle = background:#nnnnnn;
  • titlestyle = background:name;
groupstyle
CSS styles applied to all group cells. This option overrides any styles applied to the entire table. Examples:
  • groupstyle = background:#nnnnnn;
  • groupstyle = text-align:[left/center/right];
  • groupstyle = vertical-align:[top/middle/bottom];
groupnstyle
CSS styles applied to specific groupN. This has the highest priority and allows different groups to have unique styles.
liststyle
CSS styles applied to all list items. If listnstyle, oddstyle, or evenstyle parameters are specified, they take precedence over this parameter.
listnstyle
CSS styles applied to specific listN. This has the highest priority and allows different lists to have unique styles.
oddstyle, evenstyle
Styles applied to odd/even-numbered lists. These override styles defined by liststyle. The default behavior is to add striped colors (white and gray) to odd/even rows to enhance readability. These settings should not be changed except in rare cases.
evenodd
[swap, even, odd]
Setting to swap reverses the odd/even styles of each list, useful for correcting mismatches caused by inserting sub-navigation boxes.
Setting to even or odd forces all lists to follow even-row or odd-row styles.
abovestyle, belowstyle
CSS styles applied to the top cell (specified by the above parameter) and the bottom cell (specified by the below parameter). Typically used for background color or text alignment:
  • abovestyle = background:#nnnnnn;
  • abovestyle = text-align:left/center/right;
Default Styles

The style settings listed here are the ones most frequently modified by editors using the navigation box. More complex styles have been excluded to keep this list simple. Most styles are set in MediaWiki:Common.css.

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 inherit the color of bodystyle, which defaults to #fdfdfd (white with a slight gray tint). Lists have text-align:left; if they have a group; otherwise, they are set to text-align:center;. As only bodystyle has a vertical alignment property, all other styles inherit its vertical-align:middle; setting.

Table Layout

A table generated by {{Navbox}} without image, above, and below parameters (gray background added for demonstration purposes):

A table generated by {{Navbox}} with image, above, and below parameters (gray background added for demonstration purposes):