Template:Navbox: Difference between revisions

From Homecoming Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Tag: Manual revert
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<div role="navigation" aria-labelledby="navbox-{{anchorencode:{{{title}}}}}" class="navbox mw-collapsible {{#ifeq:{{{state|}}}|collapsed|mw-collapsed}}" style="clear: both; position: relative; margin-top: 1em; border: 1px solid #aaa; background-color: #f9f9f9; text-align: center; font-size: 90%; {{{style|}}};"><!--
<div role="navigation" aria-labelledby="navbox-{{anchorencode:{{{title}}}}}" class="navbox mw-collapsible {{#ifeq:{{{state|}}}|collapsed|mw-collapsed}}" style="clear: both; position: relative; margin: 1em auto 0; border: 1px solid #aaa; width: 100%; max-width: 150ch; background-color: #f9f9f9; text-align: center; font-size: 90%; {{{style|}}};"><!--


---Title---
---Title---
Line 24: Line 24:


-->{{#if:{{{body|}}}|<!--
-->{{#if:{{{body|}}}|<!--
  --><div class="mw-collapsible-content nowraplinks" style="margin: 0.2em; {{{bodystyle|}}};"><!--
  --><div class="mw-collapsible-content nowraplinks" style="margin: 0.2em; padding: 0 1em; {{{bodystyle|}}};"><!--
   -->{{{body}}}<!--
   -->{{{body}}}<!--
  --></div><!--
  --></div><!--
Line 130: Line 130:
   --></div><!--
   --></div><!--
   -->}}<!--
   -->}}<!--
 
   
  --></dl><!--
-->{{#if:{{{group10|}}}|<!--
-->}}<!--
 
  -->{{#if:{{{group10|}}}|<!--
   --><div style="display: table-row;"><!--
   --><div style="display: table-row;"><!--
     --><dt class="navbox-group" style="display: table-cell; font-family: inherit; {{{basestyle|}}}; {{{groupstyle|}}}; {{{group10style|}}};"><!--
     --><dt class="navbox-group" style="display: table-cell; font-family: inherit; {{{basestyle|}}}; {{{groupstyle|}}}; {{{group10style|}}};"><!--
Line 144: Line 141:
   --></div><!--
   --></div><!--
   -->}}<!--
   -->}}<!--
--></dl><!--
-->}}<!--


---Below---
---Below---

Latest revision as of 12:44, 3 January 2024

[edit] [purge] Documentation


This template allows a navigational template to be set up relatively quickly by supplying it with navigational content, such as 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 is recommended to standardize navigational templates, and for ease of use.

Usage

Please remove the parameters that are left blank.

{{Navbox
|name    = {{subst:PAGENAME}}
|title   = 
|above   = 

|body    = 

|group1  = 
|list1   = 

|group2  = 
|list2   = 
 ...
|group10  = 
|list10   = 

|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]].
body
content to appear in the body section, a simplified alternative to group/list pairs (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]]

Further details are explained below under section Parameter descriptions. See some alternate navbox formats under: Layout overview and Examples.

Parameter descriptions

The following is a complete list of parameters for using {{Navbox}}. In most cases, the only required parameters are name, title, and either body or group1.

Setup parameters

name
The name of the template, which is needed for the "v • d • e" ("view • discuss • edit") links to work properly on all pages where the template is used. You can enter {{subst:PAGENAME}} for this value as a shortcut.
state [collapsed]
Defaults to uncollapsed. A navbox with collapsed will start out collapsed. Otherwise, the navbox will be expanded. 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>}}}.

Content

title
Text that appears centered at the top of the navbox. 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.
body
If specified, text appears in the body of the navbox. Usually a list of links. A simplified alternative to group1, list1, etc. pairs.
groupn
(i.e. group1, group2, etc.) If specified, text appears on the left side of the body of the navbox.
listn
(i.e. list1, list2, etc.) If specified, text appears to the right of the corresponding groupn parameter. Usually a list of links.
above
Text displayed below the title and above the body.
below
Text displayed below the body (groups, lists and image).

Style parameters

Styles are generally not recommended as to maintain consistency among templates and pages in Wikipedia. However, the option to modify styles is given.

style
Specifies CSS styles to apply to the outer container.
basestyle
CSS styles to apply to the title, above, below, and group cells all at once. The styles are not applied to list cells. This is convenient for easily changing the basic color of the navbox without having to repeat the style specifications for the different parts of the navbox.
titlestyle
Styles to apply to title, such as the titlebar's background color.
bodystyle
Styles to apply to body, or to the container around group and list content.
groupstyle
CSS styles to apply to the groupN cells.
groupnstyle
CSS styles to apply to a specific group, in addition to any styles specified by the groupstyle parameter.
liststyle
CSS styles to apply to all lists. Overruled by the oddstyle and evenstyle parameters (if specified) below.
listnstyle
CSS styles to apply to a specific group, in addition to any styles specified by the liststyle parameter.
listpadding
A number and unit specifying the padding around each list. Default is padding of 0.25em on the left and right, and 0em on the top and bottom.
oddstyle, evenstyle
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 lists, respectively, in order to improve readability.
evenodd [swap, even, odd, off]
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
CSS styles to apply to the content specified via the above or below parameters.
Default styles

The style settings listed here are those that editors using the navbox change most often. The other more complex style settings were left out of this list to keep it simple. Most styles are set in MediaWiki:Common.css.

style = background:#fdfdfd; text-align: center;
titlestyle = background:#ccccff; padding-left:6em; padding-right:6em;
abovestyle = background:#ddddff; padding-left:1em; padding-right:1em;
belowstyle = background:#ddddff; padding-left:1em; padding-right:1em;
groupstyle = background:#ddddff; padding-left:1em; padding-right:1em; text-align:right;
liststyle = text-align:left;
evenstyle = background:#f7f7f7;

Since liststyle and oddstyle are transparent odd lists have the color of the main style, which defaults to #fdfdfd (white with a hint of gray). A list has text-align:left; if it has a group, if not it has text-align:center;. Since only bodystyle has a vertical-align all the others inherit its vertical-align:middle;.

Layout overview

Layout generated by {{Navbox}} with group and list pairs, and without above and below parameters (gray list background color added for illustration only):

Layout generated by {{Navbox}} with body, above, and below parameters (gray list background color added for illustration only):

Examples

{{Navbox
|name = Navbox/doc
|title = [[Archetypes]]
|body = [[Blaster]]{{dot}} [[Brute]]{{dot}} [[Controller]]{{dot}} [[Corruptor]]{{dot}} [[Defender]]{{dot}} [[Dominator]]{{dot}} [[Mastermind]]{{dot}} [[Scrapper]]{{dot}} [[Sentinel]]{{dot}} [[Stalker]]{{dot}} [[Tanker]]{{dot}} [[Arachnos Soldier]]{{dot}} [[Arachnos Widow]]{{dot}} [[Peacebringer]]{{dot}} [[Warshade]]
}}
{{navbox|
| name  = Navbox/doc
| title = [[Issues|Issue Releases]]

| group1 = [[Cryptic Studios]]
| list1  = [[Issue 1]]{{dot}} [[Issue 2]]{{dot}} [[Issue 3]]{{dot}} [[Issue 4]]{{dot}} [[Issue 5]]{{dot}} [[Issue 6]]{{dot}} [[Issue 7]]{{dot}} [[Issue 8]]{{dot}} [[Issue 9]]{{dot}} [[Issue 10]]

| group2 = [[Paragon Studios]]
| list2  = [[Issue 11]]{{dot}} [[Issue 12]]{{dot}} [[Issue 13]]{{dot}} [[Issue 14]]{{dot}} [[Issue 15]]{{dot}} [[Issue 16]]{{dot}} [[Issue 17]]{{dot}} [[Issue 18]]{{dot}} [[Issue 19]]{{dot}} [[Strike Pack|Issue 19.5]]{{dot}} [[Issue 20]]{{dot}} [[Incarnates Ascend|Issue 20.5]]{{dot}} [[Issue 21]]{{dot}} [[Media Blitz|Issue 21.5]]{{dot}} [[Issue 22]]{{dot}} [[Issue 23]]{{dot}} [[Issue 24]]{{dot}} [[Issue 25 (Paragon Studios)]]

| group3 = [[Homecoming Team]]
| list3  = [[Issue 25]]{{dot}} [[Issue 26]]{{dot}} [[Issue 27]]

}}

Technical details