Template:Navbox/doc

Description
This template is used to create a navbox. This template generally should not be used directly on pages, and should instead be used on other template pages, which are then transcluded into pages (Thus creating two transclusion layers instead of just one).

Parameters
An asterisk (*) denotes a mandatory parameter.

Setup parameters
This determines where the "View", "Talk", and "Edit" links at the top of the navbox should point to. By default, it should the name of the template page where the navbox is located. Simply adding  to this parameter will suffice in most cases.
 * name*

The default collapsed/uncollapsed state for the navbox. There are four acceptable inputs:
 * state


 * : Causes the table to collapse when there are two or more collapsible navboxes on the page, and remain uncollapsed otherwise. This is the default setting.
 * : Forces it to always start off collapsed.
 * or : Forces it to always start off expanded.
 * In the above three states, viewers can toggle a collapsible navbox's state by clicking on the "show" or "hide" button.


 * : Forces the navbox to always be expanded and disables the "show" and "hide" buttons. It also uses padding to center the title.
 * : Forces the navbox to always be expanded and disables the "show" and "hide" buttons. Unlike, it does not center the title. This generally should only be used in special cases; in most cases,   will suffice if the "show/hide" buttons need to be disabled.

In many cases, you will want to provide more flexibility for the navbox and allow editors to decide whether or not the navbox should be collapsed, expanded, or set to autocollapse on a case-by-case basis. This can be done by adding  to the parameter. When the template is transcluded, editors will be able to use the  parameter to decide whether or not the template should be collapsed, expanded, or set to autocollapse on that particular page.


 * To make it start out collapsed by default, use
 * To make it start out expanded by default, use
 * To make it start out autocollapsed by default, use

In the above examples, editors will be able to choose the navbox's state on a case-by-case basis, but the navbox will default to a pre-set setting if the  parameter is left blank. For example, if you set a navbox to, and an editor uses  , that navbox will be shown as expanded; however, if they leave the   parameter blank, it will be collapsed.

If set to, this disables the "View", "Talk", and "Edit" links that are displayed to the left of the titlebar, and padding will be used to keep the title centered. Setting it to  does the same thing, except that padding will not be used to center the title. The default setting is to leave this parameter blank, and it should generally be left blank in most circumstances.
 * navbar

This permits navboxes inside navboxes to look a bit nicer. If set to  or , the borders and padding on the sides of the navbox will be removed, allowing the navbox to fit snugly inside another one. If set to, the borders and padding will be removed, allowing the template to be nested inside another element. The  parameter should not be used to nest a navbox inside another navbox;   or   exists for that. It is automatically used by Navbox subgroup.
 * border

Cell parameters
The title of the navbox which will be shown to everyone. It doesn't have to be the same name as the template.
 * title*

Displays a full-width cell between the title and the first group/list. The cell will display any text you add to this parameter.
 * above

Similar to, except that this cell is displayed below the template's body.
 * below

(i.e.,  ) If specified, this will create a cell to the left of   and displays any text you add to this parameter in it. If omitted,  will use the full width of the template. Up to a maximum of 20 groups are supported (i.e.  is the furthest you can go).
 * groupn

(i.e.,  ) Displays the body of the template. Add the links you want to appear in the navbox here. At least one  parameter is required; any additional   parameters will be displayed as a separate row. Each  may be preceded by a corresponding   parameter, if provided.
 * listn

Displays an image that is located below the title and to the right of the lists. The  parameter must be defined for the image to work correctly. Use standard wikicode for displaying the image:
 * image



N.B. Including "|right" will produce the usual left margin to provide separation from the list items and zebra striping.

Similar to, except that it displays images to the left of the lists. In order for the image to display properly, no  parameters can be specified. Follows the same syntax as  otherwise.
 * imageleft

Style parameters
All style parameters are optional.

Allows you to apply CSS styling to the title. This is often used to change the title's background colour by means of  (For example,  ).
 * titleclass

Examples:


 * — for no background color
 * — for no background color
 * — for no background color

CSS styles to be applied to the template body. Use sparingly as it may result in inconsistencies.
 * bodystyle

Examples:



CSS styles to be applied to the,  ,  , and   cells all at once. Will not affect  cells.
 * basestyle

Examples:



CSS styles to apply to  cells. Overrides any styles that are applied to the entire table.
 * groupstyle

Examples:



CSS styles to apply to a specific group, in addition to any styles specified by the  parameter. This parameter should only be used when absolutely necessary in order to maintain standardization and simplicity.
 * groupnstyle

Examples:



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. No default. However, may be overridden by the group(n)style parameter.
 * groupwidth

Examples:



CSS styles that are applied to all lists.
 * liststyles

CSS styles to apply to a specific list, in addition to any styles specified by the  parameter. This parameter should only be used when absolutely necessary in order to maintain standardization and simplicity.
 * listnstyle

Examples:



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 0 on the top and bottom. Due to complex technical reasons, simply setting "liststyle = padding: 0.5em;" (or any other padding setting) will not work.
 * listpadding

Examples:


 * (sets 0.5em padding for the top/bottom, and 0 padding for the left/right.)
 * (removes all list padding.)

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. These should not be changed except in extraordinary circumstances.
 * oddstyle
 * evenstyle

If set to, 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  or   sets all rows to have that striping color. Setting to  disables automatic row striping. This advanced parameter should only be used to fix problems when the navbox is being used as a child of another navbox and the stripes do not match up.
 * evenodd

CSS styles to apply to the top cell (specified via the  parameter) and bottom cell (specified via the   parameter). Typically used to set background color or text alignment:
 * abovestyle
 * belowstyle

CSS styles to apply to the cells where the image/imageleft sits. These styles should only be used in exceptional circumstances, usually to fix width problems if the width of groups is set and the width of the image cell grows too large.
 * imagestyle
 * imageleftstyle

Examples:

Default styles
By default, navboxes have a very plain style. To use the default styles used on the English Wikipedia, copy and paste the following parameters into a navbox template:


 * bodystyle = background: #fdfdfd; width: 100%; vertical-align: middle;
 * 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;

Credits
This template's code was taken from Template:Navbox on The Sims Wiki. See also Template:Navbox on the English Wikipedia. Part of this template's documentation was taken from Template:Navbox/doc on Wikipedia.