This is the template sandbox page for Template:Navbox with columns (diff). See also the companion subpage for test cases. |
This template is used on approximately 26,000 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them.
Preview message: Transclusion count updated automatically (see documentation). |
This template does not display in the mobile view of Wikipedia; it is desktop only. Read the documentation for an explanation. |
This template uses Lua: |
Navbox suite |
---|
|
A navigation box that presents its content in columns. Originally intended to provide a relatively straightforward means to align links prefixed by flag icons, e.g. in templates offering links to country articles.
Only required parameters and colwidth included.
{{Navbox with columns
| name = {{subst:PAGENAME}}
| title =
| colwidth = <!--(to set a default width for each column,
preferably in a proportional unit such as 'em'*)-->
| col1 =
| col2 =
}}
collapsed
, uncollapsed
, plain
, off
, and the default autocollapse
. See {{Navbox}} for more information.plain
, off
, and the default value of blank. See {{Navbox}} for more information.child
, none
, and the default value of blank. Set to child
if you wish to use the navbox inside of another navbox; with this option, the child navbox is borderless and fits snuggly inside of its parent navbox. The parent navbox may be the list area of {{Navbox}}, a columns of another {{Navbox with columns}}, or a section of {{Navbox with collapsible groups}}. See {{Navbox}} for more information and examples.i.e. parameters affecting the inclusion/formatting of items around the template's perimeter.
background:color
(background defaults to Navbox default).background:color
per titlestyle above.colwidth = 15.0em
colwidth = 25%
fullwidth = on
col1
is required. There can be a maximum of 20 columns.col1headercolspan = 3
, then leave col2header
and col3header
blank.col1footercolspan = 3
, then leave col2footer
and col3footer
blank.You may wish to add a few extra groups and/or lists below the columns. The following parameters are given to provide such functionality. See {{Navbox}} for a more complete description of how they work, and for more examples.
[swap, even, odd, off]
This template supports the addition of microformat information. This is done by adding "class" attributes to various data cells, indicating what kind of information is contained within. To flag a navbox as containing hCard information about a person, for example, add the following parameter:
|bodyclass = vcard
and
|titleclass = fn
or (for example):
|title = The books of <span class="fn">[[Iain Banks]]</span>
...and so forth.
See Wikipedia:WikiProject Microformats for more information on adding microformat information to Wikipedia, and microformat for more information on microformats in general.
{{Navbox with columns
| name = East Asia Summit (EAS)
| title = [[East Asia Summit|East Asia Summit (EAS)]]
| listclass = plainlist
| width = 18.25em
| padding = 10em
| aboveclass = hlist
| abovestyle = font-weight: bold;
| above =
* [[First East Asia Summit|First]]
* [[Second East Asia Summit|Second]]
* [[Third East Asia Summit|Third]]
* [[Fourth East Asia Summit|Fourth]]
* [[Fifth East Asia Summit|Fifth]]
* [[Sixth East Asia Summit|Sixth]]
* [[Seventh East Asia Summit|Seventh]]
| col1 =
* [[Australia]]
* [[Brunei]]
* [[Burma]]
| col2 =
* [[Cambodia]]
* [[China]]
* [[India]]
| col3 =
* [[Indonesia]]
* [[Japan]]
* [[Laos]]
| col4 =
* [[Malaysia]]
* [[New Zealand]]
* [[Philippines]]
| col5 =
* [[Russia]]
* [[Singapore]]
* [[South Korea]]
| col6width = 17em
| col6 =
* [[Thailand]]
* [[United States]]
* [[Vietnam]]
}}
{{Navbox with columns
| name = Transit visibility table
| titlestyle = background:silver;
| title = [[Astronomical transit|Transit]] visibility from [[inferior and superior planets|planets superior]] to the transiting body
| listclass = plainlist
| colwidth = 14.2857%
| colstyle = text-align:center;
| col1header = Venus
| col1 =
* [[Transit of Mercury from Venus|Mercury]]
| col2header = Earth
| col2 =
* [[Transit of Mercury|Mercury]]
* [[Transit of Venus|Venus]]
| col3header = Mars
| col3 =
* [[Transit of Mercury from Mars|Mercury]]
* [[Transit of Venus from Mars|Venus]]
* [[Transit of Earth from Mars|Earth]]
| col4header = Jupiter
| col4 =
* [[Transit of Mercury from Jupiter|Mercury]]
* [[Transit of Venus from Jupiter|Venus]]
* [[Transit of Earth from Jupiter|Earth]]
* [[Transit of Mars from Jupiter|Mars]]
| col5header = Saturn
| col5 =
* [[Transit of Mercury from Saturn|Mercury]]
* [[Transit of Venus from Saturn|Venus]]
* [[Transit of Earth from Saturn|Earth]]
* [[Transit of Mars from Saturn|Mars]]
* [[Transit of Jupiter from outer planets|Jupiter]]
| col6header = Uranus
| col6 =
* [[Transit of Mercury from Uranus|Mercury]]
* [[Transit of Venus from Uranus|Venus]]
* [[Transit of Earth from Uranus|Earth]]
* [[Transit of Mars from Uranus|Mars]]
* [[Transit of Jupiter from outer planets|Jupiter]]
* [[Transit of Saturn from outer planets|Saturn]]
| col7header = Neptune
| col7 =
* [[Transit of Mercury from Neptune|Mercury]]
* [[Transit of Venus from Neptune|Venus]]
* [[Transit of Earth from Neptune|Earth]]
* [[Transit of Mars from Neptune|Mars]]
* [[Transit of Jupiter from outer planets|Jupiter]]
* [[Transit of Saturn from outer planets|Saturn]]
* [[Transit of Uranus from Neptune|Uranus]]
}}
The gray background for the columns is added for illustration only.
The gray background for the columns is added for illustration only. This example shows the colnheadercolspan parameter being used, but you may also use colnfootercolspan to adjust the span of the footer cells.
The gray background and centered text for the columns is for illustration only. The columns default to an off-white background and left text alignment. This example shows how you can use up to six additional groups/lists after the columns.
All three types of navbox templates, namely {{Navbox}}, {{Navbox with columns}}, and {{Navbox with collapsible groups}}, can be nested inside of one another using the border
parameter (which is common to all three). For complex templates, it may be necessary to use nesting to achieve a desired look.
To nest a plain navbox (that is, a navbox that would be specified with the {{Navbox}} template) inside a column, set the coln
parameter to child
or subgroup
. Elements of the child navbox can be specified by prepending coln_
to the parameter names (e.g. col1_list1
). Child navboxes can be nested by adding an additional prefix (e.g. col1_1_list1
).
To nest a plain navbox inside a list, set the listn
parameter to child
or subgroup
. Elements of the child navbox can be specified by prepending childn_
, subgroupn_
, or just n_
to the parameter names (e.g. 1_list1
). Child navboxes can be nested by adding an additional prefix (e.g. 1_1_list1
).
The basic code for doing this is as follows (which adds a subgroup for the first column and for the first group/list area):
{{Navbox with columns | name = {{subst:PAGENAME}} | title = Title | col1 = child | col1_title = [optional] | col1_group1 = [optional] | col1_list1 = ...list contents... ... | group1 = Group Title | list1 = child | 1_title = [optional] | 1_group1 = [optional] | 1_list1 = child | 1_1_title = [optional] | 1_1_group1 = [optional] | 1_1_list1 = ...list contents... ... ... }}
This example shows how one can nest multiple {{Navbox with columns}} templates to get the right look. Edit this page to see the code. There is a main {{Navbox with columns}} and two additional {{Navbox with columns}} templates, with the "child" option set (see code).
This example shows {{Navbox}}, {{Navbox with collapsible groups}} and {{Navbox with columns}} all working together. Edit this page to see the code. Note that each of the child navboxes has the first parameter set to child
.
{{Navbox with columns}}
can be replaced with {{#invoke:Navbox with columns|navbox}}
, which approximately halves the include sizeTemplate | Collapsible | Image | Groups | Style (body) parameter/s |
---|---|---|---|---|
{{Navbox}} | collapsible | Left/right of body | Yes | Yes |
{{Navbox with collapsible groups}} | collapsible | Left/right of body and/or in each list | Yes | Yes |
{{Navbox with columns}} | collapsible | Left/right of columns | No | Yes |
Type | CSS classes | JavaScript | Collapses when | Custom initial state |
Nesting |
---|---|---|---|---|---|
Collapsible tables | mw-collapsible | jQuery.makeCollapsible | 2 or more autocollapse on page | Yes | Yes |