v50 Steam/Premium information for editors
- v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
- Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.
Difference between revisions of "Template:Navbox/doc"
Jump to navigation
Jump to search
Doorkeeper (talk | contribs) |
Doorkeeper (talk | contribs) |
||
(7 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
<pre style="overflow: auto;">{{Navbox | <pre style="overflow: auto;">{{Navbox | ||
− | | name = {{subst:PAGENAME}}{{subst: | + | | name = {{subst:PAGENAME}}{{subst:null|Don't change anything on this line. It will change itself when you save.}} |
| title = | | title = | ||
| state = {{{state|}}} | | state = {{{state|}}} | ||
Line 20: | Line 20: | ||
| list3 = | | list3 = | ||
− | <!-- ... (up to | + | <!-- ... (up to group30 & list30) --> |
| below = | | below = | ||
Line 27: | Line 27: | ||
==Parameters== | ==Parameters== | ||
− | |||
===Setup parameters=== | ===Setup parameters=== | ||
− | : <code>name</code> | + | : <code>name</code> — the title portion of the template's page location, i.e. <code><nowiki>[[Template:NAME HERE]]</nowiki></code>. Required for the top-left navbar to work properly. |
− | : <code>state</code> | + | ::When creating a new navbox, you can set this parameter to <code><nowiki>{{subst:PAGENAME}}</nowiki></code>; this will automatically turn into the template's name when you save your changes. |
− | : <code>navbar</code> | + | : <code>state</code> — sets the initial collapsed state. Common values include <code>autocollapse</code>, <code>collapsed</code>, <code>uncollapsed</code> and <code>expanded</code>. Defaults to <code>autocollapse</code>. It is strongly recommended to set this parameter to <code><nowiki>{{{state|}}}</nowiki></code>, as this allows users to change the navbox's state locally, e.g. <code><nowiki>{{Creatures|state=expanded}}</nowiki></code>. |
+ | :: <code>autocollapse</code> — hides the content if there is another collapsible element on the page. Otherwise, it shows the content. | ||
+ | :: <code>collapsed</code> — hides the content. | ||
+ | :: <code>expanded</code> or <code>uncollapsed</code> — shows the content. | ||
+ | : <code>navbar</code> — disables the navigation links on the top-left. Only accepts <code>off</code>. | ||
+ | : <code>border</code> or <code>{{{1}}}</code> — accepted values are <code>subgroup</code> and <code>child</code>. See [[#Child navboxes|§ Child navboxes]]. | ||
===Cells=== | ===Cells=== | ||
− | : <code>title</code> | + | : <code>title</code> — title text. |
− | : <code>above</code> | + | : <code>above</code> — text between the title bar and the first group/list. |
− | : <code>group<sub>n</sub></code> | + | : <code>group<sub>n</sub></code> (''group1'', ''group2'', ... , ''group30'') — text displayed inside a box on the left side of its ''list''. Can be omitted. It won't display if its ''list'' is empty or undefined. |
− | : <code>list<sub>n</sub></code> | + | : <code>list<sub>n</sub></code> (''list1'', ''list2'', ... , ''group30'') — main content, usually a list of links. Unlike ''group'', it can exist on its own; if ''group'' is omitted, the text will be centered. |
− | : <code>below</code> | + | : <code>below</code> — footer text (bar below groups and lists). |
===Style parameters=== | ===Style parameters=== | ||
− | : <code>bodystyle</code> | + | Quotations ("") or <code>style=</code> are unnecessary. |
− | : <code>titlestyle</code> | + | |
− | : <code>basestyle</code> | + | : <code>bodystyle</code> — CSS style for the <nowiki><table></nowiki> element. |
− | : <code>abovestyle</code> | + | : <code>titlestyle</code> — CSS style for the title bar. |
− | : <code>belowstyle</code> | + | : <code>basestyle</code> — Combination of titlestyle, abovestyle, belowstyle and groupstyle. Overwritten by titlestyle, abovestyle, belowstyle, groupstyle and group<sub>n</sub>style. |
− | : <code>groupstyle</code> | + | : <code>abovestyle</code> — CSS style for the above bar. |
− | : <code>group<sub>n</sub>style</code> | + | : <code>belowstyle</code> — CSS style for the below bar. |
− | : <code>liststyle</code> | + | : <code>groupstyle</code> — CSS style for all group boxes. |
− | : <code>list<sub>n</sub>style</code> | + | : <code>group<sub>n</sub>style</code> — CSS style for a specific group box, where <sub>n</sub> denotes the group (group1style → group1, etc.). |
− | : <code>listpadding</code> | + | : <code>liststyle</code> — CSS style for all lists. |
+ | : <code>list<sub>n</sub>style</code> — CSS style for a specific list, where <sub>n</sub> denotes the list (list1style → list1, etc.). | ||
+ | : <code>listpadding</code> — sets the padding for lists. Default is <code>0em 0.25em</code>. | ||
====Default styles==== | ====Default styles==== | ||
<syntaxhighlight lang="css"> | <syntaxhighlight lang="css"> | ||
− | bodystyle = background: #fdfdfd; border: 1px solid #aaa; font-size: | + | bodystyle = background: #fdfdfd; border: 1px solid #aaa; font-size: 88%; margin: 0 auto -1px; vertical-align: middle; width: 60%; |
titlestyle = background: #ccccff; border: 1px solid #aaa; padding: 0.25em 1em; text-align: center; | titlestyle = background: #ccccff; border: 1px solid #aaa; padding: 0.25em 1em; text-align: center; | ||
abovestyle = background: #ddddff; padding: 0.25em 1em; text-align: center; | abovestyle = background: #ddddff; padding: 0.25em 1em; text-align: center; | ||
Line 110: | Line 116: | ||
| name = Navbox/doc | | name = Navbox/doc | ||
| title = [[Soil]] | | title = [[Soil]] | ||
− | | state = | + | | state = expanded |
− | | titlestyle = background-color: # | + | | navbar = off |
− | | basestyle = background-color: # | + | | titlestyle = background-color: #FFFF00; |
+ | | basestyle = background-color: #C0C0C0; | ||
| group1 = Topsoil | | group1 = Topsoil | ||
| list1 = [[Loam]] • [[Loamy sand]] • [[Peat]] • [[Sandy clay loam]] • [[Sandy loam]] • [[Silt]] • [[Silt loam]] • [[Silty clay loam]] | | list1 = [[Loam]] • [[Loamy sand]] • [[Peat]] • [[Sandy clay loam]] • [[Sandy loam]] • [[Silt]] • [[Silt loam]] • [[Silty clay loam]] | ||
+ | | group2style = background-color: #00FFFF; color: white; | ||
| group2 = Ocean floor | | group2 = Ocean floor | ||
| list2 = [[Calcareous ooze]] • [[Pelagic clay]] • [[Siliceous ooze]] | | list2 = [[Calcareous ooze]] • [[Pelagic clay]] • [[Siliceous ooze]] | ||
Line 124: | Line 132: | ||
| group4 = Clay | | group4 = Clay | ||
+ | | list4style = border: 1px solid black; font-size: 114%; | ||
| list4 = [[Clay]] • [[Clay loam]] • [[Fire clay]] • [[Sandy clay]] • [[Silty clay]] | | list4 = [[Clay]] • [[Clay loam]] • [[Fire clay]] • [[Sandy clay]] • [[Silty clay]] | ||
Line 133: | Line 142: | ||
| name = Navbox/doc | | name = Navbox/doc | ||
| title = [[Soil]] | | title = [[Soil]] | ||
− | | state = | + | | state = expanded |
− | | titlestyle = background-color: # | + | | navbar = off |
− | | basestyle = background-color: # | + | | titlestyle = background-color: #FFFF00; |
+ | | basestyle = background-color: #C0C0C0; | ||
| group1 = Topsoil | | group1 = Topsoil | ||
| list1 = [[Loam]] • [[Loamy sand]] • [[Peat]] • [[Sandy clay loam]] • [[Sandy loam]] • [[Silt]] • [[Silt loam]] • [[Silty clay loam]] | | list1 = [[Loam]] • [[Loamy sand]] • [[Peat]] • [[Sandy clay loam]] • [[Sandy loam]] • [[Silt]] • [[Silt loam]] • [[Silty clay loam]] | ||
+ | | group2style = background-color: #00FFFF; color: white; | ||
| group2 = Ocean floor | | group2 = Ocean floor | ||
| list2 = [[Calcareous ooze]] • [[Pelagic clay]] • [[Siliceous ooze]] | | list2 = [[Calcareous ooze]] • [[Pelagic clay]] • [[Siliceous ooze]] | ||
Line 147: | Line 158: | ||
| group4 = Clay | | group4 = Clay | ||
+ | | list4style = border: 1px solid black; font-size: 114%; | ||
| list4 = [[Clay]] • [[Clay loam]] • [[Fire clay]] • [[Sandy clay]] • [[Silty clay]] | | list4 = [[Clay]] • [[Clay loam]] • [[Fire clay]] • [[Sandy clay]] • [[Silty clay]] | ||
Line 167: | Line 179: | ||
</pre> | </pre> | ||
− | === | + | ===Multiple subgroups example=== |
<pre style="overflow: auto;">{{Navbox | <pre style="overflow: auto;">{{Navbox | ||
| name = Navbox/doc | | name = Navbox/doc | ||
| title = Multiple subgroups example | | title = Multiple subgroups example | ||
− | | state = | + | | state = expanded |
| above = Above | | above = Above | ||
+ | |||
| group1 = Group 1 | | group1 = Group 1 | ||
| list1 = List 1 | | list1 = List 1 | ||
+ | |||
| group2 = Group 2 | | group2 = Group 2 | ||
| list2 = {{Navbox|child | | list2 = {{Navbox|child | ||
Line 183: | Line 197: | ||
| list3 = List 2.3 | | list3 = List 2.3 | ||
}} | }} | ||
+ | |||
| group3 = Group 3 | | group3 = Group 3 | ||
| list3 = List 3 | | list3 = List 3 | ||
+ | |||
| group4 = Group 4 | | group4 = Group 4 | ||
| list4 = {{Navbox|child | | list4 = {{Navbox|child | ||
Line 204: | Line 220: | ||
| list3 = List 4.3 | | list3 = List 4.3 | ||
}} | }} | ||
+ | |||
| below = Below | | below = Below | ||
}} | }} | ||
Line 211: | Line 228: | ||
| name = Navbox/doc | | name = Navbox/doc | ||
| title = Multiple subgroups example | | title = Multiple subgroups example | ||
− | | state = | + | | state = expanded |
| above = Above | | above = Above | ||
+ | |||
| group1 = Group 1 | | group1 = Group 1 | ||
| list1 = List 1 | | list1 = List 1 | ||
+ | |||
| group2 = Group 2 | | group2 = Group 2 | ||
| list2 = {{Navbox|child | | list2 = {{Navbox|child | ||
Line 223: | Line 242: | ||
| list3 = List 2.3 | | list3 = List 2.3 | ||
}} | }} | ||
+ | |||
| group3 = Group 3 | | group3 = Group 3 | ||
| list3 = List 3 | | list3 = List 3 | ||
+ | |||
| group4 = Group 4 | | group4 = Group 4 | ||
| list4 = {{Navbox|child | | list4 = {{Navbox|child | ||
Line 244: | Line 265: | ||
| list3 = List 4.3 | | list3 = List 4.3 | ||
}} | }} | ||
+ | |||
| below = Below | | below = Below | ||
}} | }} | ||
− | ===Collapsible | + | ===Collapsible subgroups example=== |
<pre style="overflow: auto;">{{Navbox | <pre style="overflow: auto;">{{Navbox | ||
| name = Navbox/doc | | name = Navbox/doc | ||
− | | title = Collapsible | + | | title = Collapsible subgroups example |
− | | state = {{ | + | | state = expanded |
− | | | + | |
− | | group1 = Group 1 | + | | list1 = {{Navbox|child |
− | | list1 = List 1 | + | | title = Collapsible subgroup 1 |
− | | group2 = Group 2 | + | | group1 = Group 1.1 |
+ | | list1 = List 1.1 | ||
+ | | group2 = Group 1.2 | ||
+ | | list2 = List 1.2 | ||
+ | }} | ||
+ | |||
| list2 = {{Navbox|child | | list2 = {{Navbox|child | ||
+ | | title = Collapsible subgroup 2 | ||
| state = expanded | | state = expanded | ||
− | |||
| above = Above | | above = Above | ||
| group1 = Group 2.1 | | group1 = Group 2.1 | ||
Line 264: | Line 291: | ||
| group2 = Group 2.2 | | group2 = Group 2.2 | ||
| list2 = List 2.2 | | list2 = List 2.2 | ||
− | |||
− | |||
| below = Below | | below = Below | ||
}} | }} | ||
+ | |||
| group3 = Group 3 | | group3 = Group 3 | ||
− | | list3 = List 3 | + | | list3 = {{Navbox|child |
− | | | + | | title = Collapsible subgroup 3 |
+ | | group1 = Group 3.1 | ||
+ | | list1 = List 3.1 | ||
+ | | group2 = Group 3.2 | ||
+ | | list2 = List 3.2 | ||
+ | }} | ||
}} | }} | ||
</pre> | </pre> | ||
Line 276: | Line 307: | ||
{{Navbox | {{Navbox | ||
| name = Navbox/doc | | name = Navbox/doc | ||
− | | title = Collapsible | + | | title = Collapsible subgroups example |
− | | state = {{ | + | | state = expanded |
− | | | + | |
− | | group1 = Group 1 | + | | list1 = {{Navbox|child |
− | | list1 = List 1 | + | | title = Collapsible subgroup 1 |
− | | group2 = Group 2 | + | | group1 = Group 1.1 |
+ | | list1 = List 1.1 | ||
+ | | group2 = Group 1.2 | ||
+ | | list2 = List 1.2 | ||
+ | }} | ||
+ | |||
| list2 = {{Navbox|child | | list2 = {{Navbox|child | ||
+ | | title = Collapsible subgroup 2 | ||
| state = expanded | | state = expanded | ||
− | |||
| above = Above | | above = Above | ||
| group1 = Group 2.1 | | group1 = Group 2.1 | ||
Line 290: | Line 326: | ||
| group2 = Group 2.2 | | group2 = Group 2.2 | ||
| list2 = List 2.2 | | list2 = List 2.2 | ||
− | |||
− | |||
| below = Below | | below = Below | ||
}} | }} | ||
+ | |||
| group3 = Group 3 | | group3 = Group 3 | ||
− | | list3 = List 3 | + | | list3 = {{Navbox|child |
− | | | + | | title = Collapsible subgroup 3 |
+ | | group1 = Group 3.1 | ||
+ | | list1 = List 3.1 | ||
+ | | group2 = Group 3.2 | ||
+ | | list2 = List 3.2 | ||
+ | }} | ||
}}<includeonly>[[Category:Navigation templates|*]]</includeonly> | }}<includeonly>[[Category:Navigation templates|*]]</includeonly> | ||
<noinclude>[[Category:Template Documentation]]</noinclude> | <noinclude>[[Category:Template Documentation]]</noinclude> |
Latest revision as of 08:15, 22 July 2023
This template is used for creating navigational templates (also known as navboxes).
Usage[edit]
Please remove the parameters that are left blank.
{{Navbox | name = {{subst:PAGENAME}}{{subst:null|Don't change anything on this line. It will change itself when you save.}} | title = | state = {{{state|}}} | above = | group1 = | list1 = | group2 = | list2 = | group3 = | list3 = <!-- ... (up to group30 & list30) --> | below = }}
Parameters[edit]
Setup parameters[edit]
name
— the title portion of the template's page location, i.e.[[Template:NAME HERE]]
. Required for the top-left navbar to work properly.- When creating a new navbox, you can set this parameter to
{{subst:PAGENAME}}
; this will automatically turn into the template's name when you save your changes.
- When creating a new navbox, you can set this parameter to
state
— sets the initial collapsed state. Common values includeautocollapse
,collapsed
,uncollapsed
andexpanded
. Defaults toautocollapse
. It is strongly recommended to set this parameter to{{{state|}}}
, as this allows users to change the navbox's state locally, e.g.{{Creatures|state=expanded}}
.autocollapse
— hides the content if there is another collapsible element on the page. Otherwise, it shows the content.collapsed
— hides the content.expanded
oruncollapsed
— shows the content.
navbar
— disables the navigation links on the top-left. Only acceptsoff
.border
or{{{1}}}
— accepted values aresubgroup
andchild
. See § Child navboxes.
Cells[edit]
title
— title text.above
— text between the title bar and the first group/list.groupn
(group1, group2, ... , group30) — text displayed inside a box on the left side of its list. Can be omitted. It won't display if its list is empty or undefined.listn
(list1, list2, ... , group30) — main content, usually a list of links. Unlike group, it can exist on its own; if group is omitted, the text will be centered.below
— footer text (bar below groups and lists).
Style parameters[edit]
Quotations ("") or style=
are unnecessary.
bodystyle
— CSS style for the <table> element.titlestyle
— CSS style for the title bar.basestyle
— Combination of titlestyle, abovestyle, belowstyle and groupstyle. Overwritten by titlestyle, abovestyle, belowstyle, groupstyle and groupnstyle.abovestyle
— CSS style for the above bar.belowstyle
— CSS style for the below bar.groupstyle
— CSS style for all group boxes.groupnstyle
— CSS style for a specific group box, where n denotes the group (group1style → group1, etc.).liststyle
— CSS style for all lists.listnstyle
— CSS style for a specific list, where n denotes the list (list1style → list1, etc.).listpadding
— sets the padding for lists. Default is0em 0.25em
.
Default styles[edit]
bodystyle = background: #fdfdfd; border: 1px solid #aaa; font-size: 88%; margin: 0 auto -1px; vertical-align: middle; width: 60%;
titlestyle = background: #ccccff; border: 1px solid #aaa; padding: 0.25em 1em; text-align: center;
abovestyle = background: #ddddff; padding: 0.25em 1em; text-align: center;
belowstyle = background: #ddddff; padding: 0.25em 1em; text-align: center;
groupstyle = background: #ddddff; padding: 0.25em 1em; text-align: right; white-space: nowrap; width: 1%;
liststyle = background: transparent; padding: 0; text-align: left/center;
A list defaults to text-align: left;
if it has a group, if not it defaults to text-align: center;
. Although lists have their padding set to 0, as shown here, the actual value is 0 0.25em;
, which is defined in each list's <div> instead.
Layout[edit]
Without above and below[edit]
{{{title}}} | |
---|---|
{{{group1}}} |
{{{list1}}} |
{{{group2}}} |
{{{list2}}} |
{{{list3}}} without {{{group3}}} | |
{{{group4}}} |
{{{list4}}} |
With above and below[edit]
{{{title}}} | |
---|---|
{{{above}}} | |
{{{group1}}} |
{{{list1}}} |
{{{group2}}} |
{{{list2}}} |
{{{list3}}} without {{{group3}}} | |
{{{group4}}} |
{{{list4}}} |
{{{below}}} |
Without groups, above and below[edit]
{{{title}}} | |
---|---|
{{{list1}}} | |
{{{list2}}} | |
{{{list3}}} | |
{{{list4}}} |
Example[edit]
{{Navbox | name = Navbox/doc | title = [[Soil]] | state = expanded | navbar = off | titlestyle = background-color: #FFFF00; | basestyle = background-color: #C0C0C0; | group1 = Topsoil | list1 = [[Loam]] • [[Loamy sand]] • [[Peat]] • [[Sandy clay loam]] • [[Sandy loam]] • [[Silt]] • [[Silt loam]] • [[Silty clay loam]] | group2style = background-color: #00FFFF; color: white; | group2 = Ocean floor | list2 = [[Calcareous ooze]] • [[Pelagic clay]] • [[Siliceous ooze]] | group3 = [[Sand]] | list3 = [[Sand (tan)]] • [[Black sand]] • [[Red sand]] • [[White sand]] • [[Yellow sand]] | group4 = Clay | list4style = border: 1px solid black; font-size: 114%; | list4 = [[Clay]] • [[Clay loam]] • [[Fire clay]] • [[Sandy clay]] • [[Silty clay]] | below = See also: [[Template:DF2014 stones|Stones]] }}
Topsoil | |
---|---|
Ocean floor | |
Sand | |
Clay | |
See also: Stones |
[edit]
Usage[edit]
{{Navbox | name = {{subst:PAGENAME}} | title = Title | group1 = [optional] | list1 = {{Navbox|child ...child navbox parameters... }} ... }}
Multiple subgroups example[edit]
{{Navbox | name = Navbox/doc | title = Multiple subgroups example | state = expanded | above = Above | group1 = Group 1 | list1 = List 1 | group2 = Group 2 | list2 = {{Navbox|child | group1 = Group 2.1 | list1 = List 2.1 | list2 = List 2.2 ''without Group 2.2'' | group3 = Group 2.3 | list3 = List 2.3 }} | group3 = Group 3 | list3 = List 3 | group4 = Group 4 | list4 = {{Navbox|child | group1 = Group 4.1 | list1 = List 4.1 | group2 = Group 4.2 | list2 = {{Navbox|child | group1 = Group 4.2.1 | list1 = List 4.2.1 | group2 = Group 4.2.2 | list2 = {{Navbox|child | group1 = Group 4.2.2.1 | list1 = List 4.2.2.1 }} | group3 = Group 4.2.3 | list3 = List 4.2.3 }} | group3 = Group 4.3 | list3 = List 4.3 }} | below = Below }}
Multiple subgroups example | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Above | |||||||||||||||
Group 1 |
List 1 | ||||||||||||||
Group 2 |
| ||||||||||||||
Group 3 |
List 3 | ||||||||||||||
Group 4 |
| ||||||||||||||
Below |
Collapsible subgroups example[edit]
{{Navbox | name = Navbox/doc | title = Collapsible subgroups example | state = expanded | list1 = {{Navbox|child | title = Collapsible subgroup 1 | group1 = Group 1.1 | list1 = List 1.1 | group2 = Group 1.2 | list2 = List 1.2 }} | list2 = {{Navbox|child | title = Collapsible subgroup 2 | state = expanded | above = Above | group1 = Group 2.1 | list1 = List 2.1 | group2 = Group 2.2 | list2 = List 2.2 | below = Below }} | group3 = Group 3 | list3 = {{Navbox|child | title = Collapsible subgroup 3 | group1 = Group 3.1 | list1 = List 3.1 | group2 = Group 3.2 | list2 = List 3.2 }} }}
Collapsible subgroups example | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||
| |||||||||||
Group 3 |
|