Difference between revisions of "Template:Navbox"

From Bohemia Interactive Community
Jump to navigation Jump to search
m (fixed documentation)
m (Some wiki formatting)
 
(8 intermediate revisions by the same user not shown)
Line 7: Line 7:
 
{{{title4|}}}{{{content4|}}}
 
{{{title4|}}}{{{content4|}}}
 
{{{title5|}}}{{{content5|}}}
 
{{{title5|}}}{{{content5|}}}
    {{{title6|}}}{{{content6|}}}
+
{{{title6|}}}{{{content6|}}}
    {{{title7|}}}{{{content7|}}}
+
{{{title7|}}}{{{content7|}}}
    {{{title8|}}}{{{content8|}}}
+
{{{title8|}}}{{{content8|}}}
 
|
 
|
{{{!}} {{#if:{{{sub|}}}||class{{=}}"mw-collapsible"}} style{{=}}"{{#if:{{{sub|}}}
+
{{{!}} class{{=}}"navboxWiki{{#if:{{{sub|}}}||<nowiki/> mw-collapsible{{#if:{{{collapsed|}}}|<nowiki/> mw-collapsed}}{{#if:{{{minWidth|}}}|" style{{=}}"min-width: {{{minWidth}}}}}}}"
| margin: -0.125em -0.5em; width: 100%;
 
| font-size: .85em; margin: 1em auto;
 
}} min-width: 75%"
 
 
{{#if:{{{sub|}}}||
 
{{#if:{{{sub|}}}||
{{!}}- style{{=}}"background-color: {{{color|#DDD}}}"
+
{{!}}-
! colspan{{=}}"2" {{!}} {{#if:{{{title|}}}|<span style="font-size: 1.25em; padding: .5em 2em">{{{title}}}</span>}}
+
! {{#if:{{{color|}}}|style{{=}}"background-color: {{{color}}}"}} colspan{{=}}"2" {{!}} {{{title|}}}<br>
 
{{!}}-
 
{{!}}-
 
}}
 
}}
Line 24: Line 21:
 
|
 
|
 
{{#if:{{{title1|}}}
 
{{#if:{{{title1|}}}
| ! style{{=}}"background-color: {{{color1|#EEE}}}; padding: .5em 1em" {{!}} {{{title1}}}
+
| ! {{#if:{{{color1|}}}|style{{=}}"background-color: {{{color1}}}" {{!}}}} {{{title1}}}
{{!}} style{{=}}"padding: 0 0.5em" {{!}}
+
{{!}}
 
{{{content1|}}}
 
{{{content1|}}}
| {{!}} colspan{{=}}"2" style{{=}}"padding: 0.5em; text-align: center" {{!}} {{{content1|}}} }}
+
| {{!}} colspan{{=}}"2" {{!}} {{{content1|}}}
 +
}}
 
{{!}}-
 
{{!}}-
 
}}
 
}}
Line 34: Line 32:
 
|
 
|
 
{{#if:{{{title2|}}}
 
{{#if:{{{title2|}}}
| ! style{{=}}"background-color: {{{color2|#EEE}}}; padding: 0.5em 1em" {{!}} {{{title2}}}
+
| ! {{#if:{{{color2|}}}|style{{=}}"background-color: {{{color2}}}" {{!}}}} {{{title2}}}
{{!}} style{{=}}"padding: 0 0.5em" {{!}}
+
{{!}}
 
{{{content2|}}}
 
{{{content2|}}}
| {{!}} colspan{{=}}"2" style{{=}}"padding: 0.5em; text-align: center" {{!}} {{{content2|}}} }}
+
| {{!}} colspan{{=}}"2" {{!}} {{{content2|}}}
 +
}}
 
{{!}}-
 
{{!}}-
 
}}
 
}}
Line 44: Line 43:
 
|
 
|
 
{{#if:{{{title3|}}}
 
{{#if:{{{title3|}}}
| ! style{{=}}"background-color: {{{color3|#EEE}}}; padding: 0.5em 1em" {{!}} {{{title3}}}
+
| ! {{#if:{{{color3|}}}|style{{=}}"background-color: {{{color3}}}" {{!}}}} {{{title3}}}
{{!}} style{{=}}"padding: 0 0.5em" {{!}}
+
{{!}}
 
{{{content3|}}}
 
{{{content3|}}}
| {{!}} colspan{{=}}"2" style{{=}}"padding: 0.5em; text-align: center" {{!}} {{{content3|}}} }}
+
| {{!}} colspan{{=}}"2" {{!}} {{{content3|}}}
 +
}}
 
{{!}}-
 
{{!}}-
 
}}
 
}}
Line 54: Line 54:
 
|
 
|
 
{{#if:{{{title4|}}}
 
{{#if:{{{title4|}}}
| ! style{{=}}"background-color: {{{color4|#EEE}}}; padding: 0.5em 1em" {{!}} {{{title4}}}
+
| ! {{#if:{{{color4|}}}|style{{=}}"background-color: {{{color4}}}" {{!}}}} {{{title4}}}
{{!}} style{{=}}"padding: 0 0.5em" {{!}}
+
{{!}}
 
{{{content4|}}}
 
{{{content4|}}}
| {{!}} colspan{{=}}"2" style{{=}}"padding: 0.5em; text-align: center" {{!}} {{{content4|}}} }}
+
| {{!}} colspan{{=}}"2" {{!}} {{{content4|}}}
 +
}}
 
{{!}}-
 
{{!}}-
 
}}
 
}}
Line 64: Line 65:
 
|
 
|
 
{{#if:{{{title5|}}}
 
{{#if:{{{title5|}}}
| ! style{{=}}"background-color: {{{color5|#EEE}}}; padding: 0.5em 1em" {{!}} {{{title5}}}
+
| ! {{#if:{{{color5|}}}|style{{=}}"background-color: {{{color5}}}" {{!}}}} {{{title5}}}
{{!}} style{{=}}"padding: 0 0.5em" {{!}}
+
{{!}}
 
{{{content5|}}}
 
{{{content5|}}}
| {{!}} colspan{{=}}"2" style{{=}}"padding: 0.5em; text-align: center" {{!}} {{{content5|}}} }}
+
| {{!}} colspan{{=}}"2" {{!}} {{{content5|}}}
 +
}}
 
{{!}}-
 
{{!}}-
 
}}
 
}}
Line 74: Line 76:
 
|
 
|
 
{{#if:{{{title6|}}}
 
{{#if:{{{title6|}}}
| ! style{{=}}"background-color: {{{color6|#EEE}}}; padding: 0.5em 1em" {{!}} {{{title6}}}
+
| ! {{#if:{{{color6|}}}|style{{=}}"background-color: {{{color6}}}" {{!}}}} {{{title6}}}
{{!}} style{{=}}"padding: 0 0.5em" {{!}}
+
{{!}}
 
{{{content6|}}}
 
{{{content6|}}}
| {{!}} colspan{{=}}"2" style{{=}}"padding: 0.5em; text-align: center" {{!}} {{{content6|}}} }}
+
| {{!}} colspan{{=}}"2" {{!}} {{{content6|}}}
 +
}}
 
{{!}}-
 
{{!}}-
 
}}
 
}}
Line 84: Line 87:
 
|
 
|
 
{{#if:{{{title7|}}}
 
{{#if:{{{title7|}}}
| ! style{{=}}"background-color: {{{color7|#EEE}}}; padding: 0.5em 1em" {{!}} {{{title7}}}
+
| ! {{#if:{{{color7|}}}|style{{=}}"background-color: {{{color7}}}" {{!}}}} {{{title7}}}
{{!}} style{{=}}"padding: 0 0.5em" {{!}}
+
{{!}}
 
{{{content7|}}}
 
{{{content7|}}}
| {{!}} colspan{{=}}"2" style{{=}}"padding: 0.5em; text-align: center" {{!}} {{{content7|}}} }}
+
| {{!}} colspan{{=}}"2" {{!}} {{{content7|}}}
 +
}}
 
{{!}}-
 
{{!}}-
 
}}
 
}}
Line 94: Line 98:
 
|
 
|
 
{{#if:{{{title8|}}}
 
{{#if:{{{title8|}}}
| ! style{{=}}"background-color: {{{color8|#EEE}}}; padding: 0.5em 1em" {{!}} {{{title8}}}
+
| ! {{#if:{{{color8|}}}|style{{=}}"background-color: {{{color8}}}" {{!}}}} {{{title8}}}
{{!}} style{{=}}"padding: 0 0.5em" {{!}}
+
{{!}}
 
{{{content8|}}}
 
{{{content8|}}}
| {{!}} colspan{{=}}"2" style{{=}}"padding: 0.5em; text-align: center" {{!}} {{{content8|}}} }}
+
| {{!}} colspan{{=}}"2" {{!}} {{{content8|}}}
 +
}}
 
{{!}}-
 
{{!}}-
 
}}
 
}}
Line 106: Line 111:
 
</includeonly><noinclude>
 
</includeonly><noinclude>
 
== Usage ==
 
== Usage ==
{{<nowiki/>NavboxWiki|'''''title'''''|'''''color'''''|'''''title''#'''|'''''color''#'''|'''''content''#'''|'''''sub'''''}}
+
{{<nowiki/>Navbox|'''''title'''''|'''''color'''''|'''''minWidth'''''|'''''title''#'''|'''''color''#'''|'''''content''#'''|'''''sub'''''|'''''collapsed'''''}}
 
* title: (Optional) navbox title
 
* title: (Optional) navbox title
* color: (Optional, default <tt>#</tt>)
+
* color: (Optional, default {{hl|#}})
 +
* minWidth: (Optional, default {{hl|80%}})
 
* title'''#''': (Optional, default empty) # in range 1..8: row 1..8 title
 
* title'''#''': (Optional, default empty) # in range 1..8: row 1..8 title
* color'''#''': (Optional, default <tt>#DDDDDD</tt>) # in range 1..8: row 1..8 title colour
+
* color'''#''': (Optional, default {{hl|#DDDDDD}}) # in range 1..8: row 1..8 title colour
 
* content'''#''': (Optional, default empty) # in range 1..8: row 1..8 cell content
 
* content'''#''': (Optional, default empty) # in range 1..8: row 1..8 cell content
* sub: (Optional, default empty) <tt>y</tt> defines if border and collapsible are shown
+
* sub: (Optional, default empty) {{hl|y}} defines if border and collapsible are shown
 +
* collapsed: (Optional, default empty) {{hl|y}} defines if the navbox is collapsed by default - incompatible with '''''sub'''''
 +
 
  
 
{| style="border: 1px solid #AAA; border-collapse: collapse; border-radius: .25em; width: 100%"
 
{| style="border: 1px solid #AAA; border-collapse: collapse; border-radius: .25em; width: 100%"
Line 120: Line 128:
 
! style="min-width: 50%" | Result
 
! style="min-width: 50%" | Result
 
|-
 
|-
| <nowiki>{{NavboxWiki}}</nowiki>
+
| <nowiki>{{Navbox}}</nowiki>
| {{NavboxWiki}}
+
| {{Navbox}}
 
|-
 
|-
| <nowiki>{{NavboxWiki|Hello there!}}</nowiki>
+
| <nowiki>{{Navbox|Hello there!}}</nowiki>
| {{NavboxWiki|Hello there!}}
+
| {{Navbox|Hello there!}}
 
|- style="vertical-align: top"
 
|- style="vertical-align: top"
| <pre>{{NavboxWiki
+
| <pre>{{Navbox
 
|title1= Title 1
 
|title1= Title 1
 
|content1= Hello, first content!
 
|content1= Hello, first content!
 
}}</pre>
 
}}</pre>
| {{NavboxWiki
+
| {{Navbox
 
|title1= Title 1
 
|title1= Title 1
 
|content1= Hello, first content!
 
|content1= Hello, first content!
Line 137: Line 145:
 
}}
 
}}
 
|- style="vertical-align: top"
 
|- style="vertical-align: top"
| <pre>{{NavboxWiki
+
| <pre>{{Navbox
 
|title= title displays collapse option
 
|title= title displays collapse option
 
|title1= category
 
|title1= category
 
|content1= content that is displayed here
 
|content1= content that is displayed here
 
}}</pre>
 
}}</pre>
| {{NavboxWiki
+
| {{Navbox
 
|title= title displays collapse option
 
|title= title displays collapse option
 
|title1= category
 
|title1= category
Line 148: Line 156:
 
}}
 
}}
 
|- style="vertical-align: top"
 
|- style="vertical-align: top"
| <pre>{{NavboxWiki
+
| <pre>{{Navbox
 
|title= NAVBOX TITLE
 
|title= NAVBOX TITLE
 
|color= #DAD
 
|color= #DAD
Line 158: Line 166:
 
|content3= Yep, no title.
 
|content3= Yep, no title.
 
}}</pre>
 
}}</pre>
| {{NavboxWiki
+
| {{Navbox
 
|title= NAVBOX TITLE
 
|title= NAVBOX TITLE
 
|color= #DAD
 
|color= #DAD
Line 169: Line 177:
 
}}
 
}}
 
|- style="vertical-align: top"
 
|- style="vertical-align: top"
| <pre>{{NavboxWiki
+
| <pre>{{Navbox
 
|title= NAVBOX TITLE
 
|title= NAVBOX TITLE
 
|color= #CDF
 
|color= #CDF
 
|title1= Title 1
 
|title1= Title 1
 
|content1=
 
|content1=
{{NavboxWiki
+
{{Navbox
 
|sub= y
 
|sub= y
 
|title1= title1
 
|title1= title1
Line 183: Line 191:
 
|title3= title3
 
|title3= title3
 
|content3=
 
|content3=
{{NavboxWiki
+
{{Navbox
 
|sub= y
 
|sub= y
 
|title1= wait…
 
|title1= wait…
Line 192: Line 200:
 
}}
 
}}
 
}}</pre>
 
}}</pre>
| {{NavboxWiki
+
| {{Navbox
 
|title= NAVBOX TITLE
 
|title= NAVBOX TITLE
 
|color= #CDF
 
|color= #CDF
 
|title1= Title 1
 
|title1= Title 1
 
|content1=
 
|content1=
{{NavboxWiki
+
{{Navbox
 
|sub= y
 
|sub= y
 
|title1= title1
 
|title1= title1
Line 206: Line 214:
 
|title3= title3
 
|title3= title3
 
|content3=
 
|content3=
{{NavboxWiki
+
{{Navbox
 
|sub= y
 
|sub= y
 
|title1= wait…
 
|title1= wait…

Latest revision as of 12:35, 9 May 2022

Usage

{{Navbox|title|color|minWidth|title#|color#|content#|sub|collapsed}}

  • title: (Optional) navbox title
  • color: (Optional, default #)
  • minWidth: (Optional, default 80%)
  • title#: (Optional, default empty) # in range 1..8: row 1..8 title
  • color#: (Optional, default #DDDDDD) # in range 1..8: row 1..8 title colour
  • content#: (Optional, default empty) # in range 1..8: row 1..8 cell content
  • sub: (Optional, default empty) y defines if border and collapsible are shown
  • collapsed: (Optional, default empty) y defines if the navbox is collapsed by default - incompatible with sub


Examples
Code Result
{{Navbox}}

-no navbox defined-

{{Navbox|Hello there!}}

-no navbox defined-

{{Navbox
	|title1= Title 1
	|content1= Hello, first content!
}}
{{Navbox
	|title= title displays collapse option
	|title1= category
	|content1= content that is displayed here
}}
{{Navbox
	|title= NAVBOX TITLE
	|color= #DAD
	|title1= Title 1
	|color1= #AAF
	|content1= Hello, first content!
	|content2= Wait… no title?
	|title3= hahaha
	|content3= Yep, no title.
}}
{{Navbox
	|title= NAVBOX TITLE
	|color= #CDF
	|title1= Title 1
	|content1=
		{{Navbox
			|sub= y
			|title1= title1
			|content1= content1
			|title2= title2
			|color2= #FAA
			|content2= content2
			|title3= title3
			|content3=
				{{Navbox
					|sub= y
					|title1= wait…
					|content1= stop!
					|title2= enough!
					|content2= I said.
				}}
		}}
	}}