Template:Navbox

From GodWiki
Jump to: navigation, search
 {{{title}}}
{{{list1}}}
[view] [edit] [history] [refresh]
Documentation  Documentation
Navbox templates
{{Navbox}}
{{Navbox subgroup}}
{{Navbox list}}

{{Navbox}} is a meta-template intended to provide an easy framework to quickly create consistent, attractive, and easily editted navboxes for use on the GodWiki. It should not be used directly on a page (since no navbox is useful on just one page), but is used to create the navbox templates for transclusion into a collection of closely related pages.

When giving text in all parameters, if for some reason you need to use the special characters | or =, they must be replaced with the special templates {{!}} and {{=}} respectively. So, instead of writing:

|above=f(Life, the Universe, and Everything) = 42

you need to write:

|above=f(Life, the Universe, and Everything) {{=}} 42

for it to appear as you expect it:

f(Life, the Universe, and Everything) = 42

Note, this is only if you want the symbol to appear in text; you can use | or = as normal in piped links ([[Main Page|This is a piped link]]) and templates.

Basic parameters

|title=
Required. The navbox title. Ignored by {{Navbox subgroup}}.
|list1=
Required. The first list of items for the navbox. {{Navbox list}} will automatically format lists of items for navboxes (see template page and examples below).
Note that subgroup1 can be substituted for list1 (see explanation below).
|navbarname={{subst:{{PAGENAME}}}}
Recommended. Provides a navbox name parameter for use by {{Navbar}}. Including this parameter will cause {{Navbar}} to be included; omitting it or explicitly setting it to no will cause it to be omitted. If you include this parameter exactly as written above, it will automatically insert the correct value. If you prefer, you can simply set this to the name of the template page, not including the Template: portion. In other words, if your template is called Template:Navboxauras, set |navbarname=Navboxauras. Ignored by {{Navbox subgroup}}.
|group1=
Optional. The name of the first group of items. Appears as a label to the left of |list1=.
|list2-10=
Optional. Additional lists of items for the navbox. {{Navbox list}} will automatically format lists of items for navboxes (see template page and examples below).
|group2-10=
Optional. Labels for the additional lists.
group parameters are optional, but if your navbox has more than one list, you probably want to label them.
|subgroup1-10={{Navbox subgroup|...}}
Optional. Replaces listn with a subgroup nested into this cell. See detailed explanation below.
|above=
Optional. Text to appear above the lists, directly below the title.
|below=
Optional. Text to appear below the lists, at the bottom of the table.
|collapsible=[default|yes|no]
Optional. Default yes. Sets if the table has the option to be collapsible. Adds (or omits) the mw-collapsible class. Ignored by {{Navbox subgroup}}.
|state=[default|expanded|collapsed]
Optional. The initial collapsed (mw-collapsed) state of the navbox. If omitted (or set to default), the navbox will be mw-collapsed iff any parameters |list4..6= are supplied. (In other words, if there are more than 3 lists.) Ignored by {{Navbox subgroup}}.

Simple blank template example

{{Navbox
| navbarname = {{subst:{{PAGENAME}}}}
| collapsible = {{{collapsible|default}}}
| state = {{{state|default}}}
| title = 
| group1 = 
| list1 = {{Navbox list|Item 1|Item 2|Item 3|...}}
| group2 = 
| list2 = 
...
}}

Navbox list

Navbox templates
{{Navbox}}
{{Navbox subgroup}}
{{Navbox list}}

{{Navbox list}} is intended for use with the {{Navbox}} set of templates to make correctly formatted lists of items.

Items should be wikilinked and formatted exactly as they will appear in the final list.

Example of use:

{{Navbox
|title=List example
|list1={{Navbox list|[[Item one]]|[[Piped link|Item two]]|[[Item three]] (note)}}
}}
 List example
Item one Item two Item three (note)

Up to 99 list items are supported.

{{Navbox list}} optional parameters

|bullet=
Defines a bullet to appear between the list items. The default bullet is , which is defined in the sub-page {{Navbox list/Bullet}}.
|space=
Defines the space to appear between the bullet and the adjacent list items on either side, as in:
Item[space]bullet[space]Item. The default is a normal space, and is defined in the sub-page {{Navbox list/Space}}.
|bullet-wrap=yes
By default, this template makes a list item and the bullet to its right non-breaking, so that wherever possible it stays together on a single line and doesn't wrap. Setting |bullet-wrap=yes allows list items and bullets to break freely across lines. This is only useful if your list contains very long items, which cause ugly line breaking on small screens.
|item-wrap=no
If |bullet-wrap=yes, this parameter tells the template to stop list items from breaking across a space, but allow the bullet to appear on the next line.

Formatting parameters

|title-background=
Optional. Replaces the default #ccccff background color for the title cell. Any valid HTML color value[1] should work; do not include "..." quotation marks, do include the # in front of hexadecimal values. Ignored by {{Navbox subgroup}}.
|list-background=
Optional. Replaces the default wikitable-defined background color for all list cells. Any valid HTML color value[1] should work; do not include "..." quotation marks, do include the # in front of hexadecimal values.
|group-background=
Optional. Replaces the default #ddddff background color for all group label cells. Any valid HTML color value[1] should work; do not include "..." quotation marks, do include the # in front of hexadecimal values.
|above-background=
|below-background=
Optional. Replaces the default #ddddff background color for the above or below cells respectively. Any valid HTML color value[1] should work; do not include "..." quotation marks, do include the # in front of hexadecimal values.
|listn-background=
|groupn-background=
Optional. Like |list-background= and |group-background=, but for only the specified cell. Setting this will override other colour settings for the specified cell. Any valid HTML color value[1] should work; do not include "..." quotation marks, do include the # in front of hexadecimal values.
|listn-align=[left|center|right]
Optional. Default left. Sets the alignment of the text in the specified list cell.
|groupn-wrap=yes
Optional. Overrides default white-space: nowrap behaviour for the specified group label, allowing the group label text to wrap across multiple lines.
|table-style=
Optional. Default is none. CSS styling to insert into table style. Any valid in-line CSS styles should work; do not include "..." quotation marks, do include ; semicolons.
|above-style=
|below-style=
|list-style=
|group-style=
|listn-style=
|groupn-style=
CSS properties to append to the inline style="..." attribute for the corresponding navbox area. Duplicate properties defined in increasingly specific parameters (e.g. table-, list-, and listn-style) will be successively overwritten. Any valid in-line CSS should work; do not include "..." quotation marks, do include ; semicolons.

Subgroups

Subgroups are the way to make more complex tables (anything other than simple listN lists and groupN group labels). Inserting a subgroup is as simple as replacing the corresponding |listn= parameter with a |subgroupn= parameter that contains a {{Navbox subgroup|...}}.

Subgroup labels example

With subgroups, you can make nested subgroup labels:

 Subcategory example
Big category
Subcategory 1 List of items.
Subcategory 2 List of items.
{{Navbox
|title=Subcategory example
|group1=Big category
|subgroup1={{Navbox subgroup
  |group1=Subcategory 1
  |list1=List of items.
  |group2=Subcategory 2
  |list2=List of items.
  }}
}}

Subgroup subheadings example

Including |above=Subheading text in a subgroup will create a subheading within the navbox:

 Subheading example
List of items.
Subheading
List of items.
{{Navbox
|title = Subheading example
|list1 = List of items.
|subgroup2 = {{Navbox subgroup
  |above = Subheading
  |list1 = List of items.
  }}
}}

Nested subgroups example

Subgroups can even be nested inside each other:

 Nested subgroup example
Navbox "above" cell
Navbox
First subgroup "above" cell
First subgroup
Second subgroup "above" cell
Second subgroup And so on.
Second subgroup "below" cell
First subgroup "below" cell
Navbox "below" cell
{{Navbox
|title = Nested subgroup example
|above = Navbox "above" cell
|group1 = Navbox
|subgroup1 = {{Navbox subgroup
  |above-background = #9999bb
  |group-background = #9999bb
  |below-background = #9999bb
  |above = First subgroup "above" cell
  |group1 = First subgroup
  |subgroup1 = {{Navbox subgroup
    |above = Second subgroup "above" cell
    |group1 = Second subgroup
    |list1 = And so on.
    |below = Second subgroup "below" cell
    }}
  |below = First subgroup "below" cell
  }}
|below = Navbox "below" cell
}}

Subgroups support any parameter in the lists above, except where noted. |title=, |title-background=, |title-style= and |navbarname= are ignored in subgroups, as are |collapsible= and |state=, as subgroups collapsible subgroups are not supported. The advanced parameters below will also have no effect is used in {{Navbox subgroup}}. Subgroups can be used to create all kinds of complex structures inside navboxes — use sparingly and with wisdom!

Advanced parameters

You probably shouldn't set these, unless you're sure you know what you're doing.

|width=
Optional. Sets a max-width for the table, ensuring that the table width will be the lesser of 100% or the value of {{{width}}}. Any valid width value should work. Do not include "..." quotation marks. Note that the table will be centered on the page unless |table-style= is set with margins that specify otherwise. You should probably not change this from the default unless there's a very good reason.
|subgroup=yes
This parameter is only expected to be passed from {{Navbox subgroup}}. It will suppress parts of the template as needed for the correct rendering of a subgroup.
|example=anything or |nocat=anything
Set this to disable the inclusion of category tags, for when you want to give an example of the use of {{Navbox}}, such as on a documentation page (like this one). Note that {{Navbox}} will only include [[Category:Templates]] and [[Category:Navigational Boxes]] in the Template: namespace, but template documentation is in this namespace.

Additional Examples

Example 1: Single list, centered

Single list, centered. Since we haven't set |navbarname=, we don't have a {{Navbar}} in the top left corner.

{{Navbox
| title = Simple Navbox
| list1 = {{Navbox list| Item | Item | Item | Item | Item}}
| list1-align = center
}}
 Simple Navbox
Item • Item • Item • Item • Item

Example 2: Two lists

Two lists with group labels and navbar.

{{Navbox
|title = Two lists
|group1 = One group
|list1 = {{Navbox list| Item | Item | Item | Item | Item}}
|group2 = Another group
|list2 = {{Navbox list| Item | Item | Item | Item | Item}}
|navbarname=Navbox}}
Two lists
One group Item • Item • Item • Item • Item
Another group Item • Item • Item • Item • Item

Example 3: Text below

One list, centered, with text below, not collapsible.

{{Navbox
|title = Example with text below
|list1 = {{Navbox list| Item | Item | Item | Item | Item}}
|list1-align = center
|below = ''This text appears below the lists of items.''
|collapsible=no
|navbarname=Navbox
}}
Example with text below 
Item • Item • Item • Item • Item
This text appears below the lists of items.

Example 4: Collapsing defaults

Four lists with group labels, and {{Navbar}} turned off with |navbarname=no. Note that since we don't specify |state=expanded, {{Navbox}} by default collapses the table, since it has more than 3 lists.

{{Navbox
|navbarname=no
|title = Four lists, collapsing, with no navbar
|group1 = List one
|list1 = {{Navbox list| Item | Item | Item | Item | Item}}
|group2 = List two
|list2 = {{Navbox list| Item | Item | Item | Item | Item}}
|group3 = List three
|list3 = {{Navbox list| Item | Item | Item | Item | Item}}
|group4 = List four
|list4 = {{Navbox list| Item | Item | Item | Item | Item}}
}}
 Four lists, collapsing, with no navbar
List one Item • Item • Item • Item • Item
List two Item • Item • Item • Item • Item
List three Item • Item • Item • Item • Item
List four Item • Item • Item • Item • Item

Example 5: Subgroup

The subgroup parameter is used to put two sub-groups (Subgroup 1, Subgroup 2) beside the "Big Group" group label. To do this, we use subgroup2 and the {{Navbox subgroup}} template.

{{Navbox
|navbarname = Navbox
|title = Navbox with subgroup
|group1 = First Group
|list1 = {{Navbox list| Item | Item | Item | Item | Item}}
|group2 = Big Group
|subgroup2 = {{Navbox subgroup
  |group1 = Subgroup 1
  |list1 = {{Navbox list| Item | Item | Item | Item | Item}}
  |group2 = Subgroup 2
  |list2 = {{Navbox list| Item | Item | Item | Item | Item}}
  }}
|group3 = Another Group
|list3 = {{Navbox list| Item | Item | Item | Item | Item}}
}}
Navbox with subgroup
First Group Item • Item • Item • Item • Item
Big Group
Subgroup 1 Item • Item • Item • Item • Item
Subgroup 2 Item • Item • Item • Item • Item
Another Group Item • Item • Item • Item • Item

References

  1. 1.0 1.1 1.2 1.3 1.4 See wikipedia:Web colors for information on specifying color values by name or by RGB codes. For accessibility reasons, please avoid strong or dark background colors.