Template:Navbox
(view - edit - history - purge) Documentation
This template is used for creating navigational templates (also known as navboxes). This code was borrowed from https://dwarffortresswiki.org/index.php/Template:Navbox/doc
Usage
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
WIP
Setup parameters
namestatenavbarborderor{{{1}}}
Cells
titleabovegroupnlistnbelow
Style parameters
bodystyletitlestylebasestyleabovestylebelowstylegroupstylegroupnstyleliststylelistnstylelistpadding
Default styles
<syntaxhighlight lang="css"> 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; </syntaxhighlight>
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
Without above and below
{{{title}}} | |
|---|---|
| {{{group1}}} |
{{{list1}}} |
| {{{group2}}} |
{{{list2}}} |
{{{list3}}} without {{{group3}}} | |
| {{{group4}}} |
{{{list4}}} |
With above and below
{{{title}}} | |
|---|---|
| {{{above}}} | |
| {{{group1}}} |
{{{list1}}} |
| {{{group2}}} |
{{{list2}}} |
{{{list3}}} without {{{group3}}} | |
| {{{group4}}} |
{{{list4}}} |
| {{{below}}} | |
Without groups, above and below
{{{title}}} | |
|---|---|
{{{list1}}} | |
{{{list2}}} | |
{{{list3}}} | |
{{{list4}}} |
Example
{{Navbox
| name = Navbox/doc
| title = [[Soil]]
| state = {{{state|expanded}}}
| titlestyle = background-color: #c0e1d1;
| basestyle = background-color: #b0cabd;
| group1 = Topsoil
| list1 = [[Loam]] • [[Loamy sand]] • [[Peat]] • [[Sandy clay loam]] • [[Sandy loam]] • [[Silt]] • [[Silt loam]] • [[Silty clay loam]]
| 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
| 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 | |
Usage
{{Navbox
| name = {{subst:PAGENAME}}
| title = Title
| group1 = [optional]
| list1 = {{Navbox|child
...child navbox parameters...
}}
...
}}
Multiple subgroups example
{{Navbox
| name = Navbox/doc
| title = Multiple subgroups example
| state = {{{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
{{Navbox
| name = Navbox/doc
| title = Collapsible subgroups example
| state = {{{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
| 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 |
| ||||||||||