Difference between revisions of "Template:Box"

From Kerbal Space Program Wiki
Jump to: navigation, search
m (Examples: *explicit parameter names;)
m (Undo revision 97142 by ArnePeirs (talk))
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<noinclude>== Description ==
+
<includeonly>{| class="ambox noprint" style="border-left-color: {{{3|#{{#switch: {{{type|}}}
This templates create a box with an image.
 
 
 
== Parameters ==
 
 
 
{{Parameter Table|name=both|parameters=
 
{{Parameter Row|1|Small image on the left shrunk to 40×40 pixels.|[[:File:notice.svg]]}}
 
{{Parameter Row|2|Text}}
 
{{Parameter Row|3|Color of the box. When transparent it does hide the border.|<tt>#1e90ff</tt> {{ColorBox|#1e90ff}}}}
 
{{Parameter Row|4|Title in bold.|None}}
 
{{Parameter Row|type|Type of the box.|Not set}}
 
}}
 
 
 
It is possible to add additional rows by using {{Tl|!}} in the Text parameter. One example is {{Tl|SVG available}}.
 
 
 
== Types ==
 
With types it is possible to predefine the image and color, although both can be changed.
 
 
 
{| class="wikitable"
 
! Type
 
! Image
 
! Color
 
|-
 
| Not set
 
| [[File:notice.svg|40px]]
 
| {{ColorBox|#1e90ff}}
 
|-
 
| <tt>error</tt>
 
| [[File:Ambox warning pn.svg|40px]]
 
| {{ColorBox|#b22222}}
 
|-
 
| <tt>warning</tt>
 
| [[File:warning.svg|40px]]
 
| {{ColorBox|#f4c430}}
 
|-
 
| <tt>editnotice</tt> or <tt>notice</tt>
 
| [[File:notice.svg|40px]]
 
| {{ColorBox|#bba}}
 
|}
 
 
 
== Examples ==
 
{{Box|Kerbin18.png|Text|#b22222|Title}}
 
 
 
  <nowiki>{{Box|Kerbin18.png|Text|#b22222|Title}}</nowiki>
 
 
 
{{Box|2='''This article is currently undergoing a major expansion or revamping.''' However, you are free to help in the construction of this page by improving it.}}
 
 
 
  <nowiki>{{Box|2='''This article is currently undergoing a major expansion or revamping.''' However, you are free to help in the construction of this page by improving it.}}</nowiki>
 
{{Box|type=warning|2=Most of this page is entirely speculation based on in-game observation and should not be taken as absolute fact!}}
 
 
 
  <nowiki>{{Box|type=warning|2=Most of this page is entirely speculation based on in-game observation and should not be taken as absolute fact!}}</nowiki>
 
 
 
== Additional Box templates ==
 
* {{Tl|SVG available}}
 
* {{Tl|Delete}}
 
* {{Tl|Protect}}
 
* {{Tl|Spoiler}}
 
 
 
There exists another box template named {{Tl|mbox}} which for example {{Tl|Stub}} uses.
 
 
 
[[Category:Templates|Box]]</noinclude><includeonly>{| class="ambox noprint" style="border-left-color: {{{3|#{{#switch: {{{type|}}}
 
 
|error=b22222
 
|error=b22222
 
|warning=f4c430
 
|warning=f4c430
|editnotice
+
|note
|notice=bba
+
|notice=bbbbaa
 +
|info
 +
|disambig
 
|#default=1e90ff}}}}}"
 
|#default=1e90ff}}}}}"
| class="mbox-image" | [[File:{{{1|{{#switch: {{{type|}}}
+
| class="mbox-image" | {{#if: {{{1|}}}|{{#if: {{{2|}}}|[[File:{{{1|}}}|40x40px|alt=|link=]]|[[File:{{#switch: {{{type|}}}
 
|error=Ambox warning pn.svg
 
|error=Ambox warning pn.svg
 
|warning=warning.svg
 
|warning=warning.svg
|editnotice
+
|disambig=Disambig-dark.svg
 +
|note
 
|notice
 
|notice
|#default=notice.svg}}}}}|40x40px|alt=|link=]]
+
|info
| class="mbox-text" | {{{2}}}
+
|#default=notice.svg}}|40x40px|alt=|link=]]}}}}
|}</includeonly>
+
| class="mbox-text" | {{#if: {{{2|}}}|{{{2}}}|{{{1}}}}}
 +
|}</includeonly><noinclude>
 +
{{Documentation}}
 +
</noinclude>

Latest revision as of 23:52, 4 February 2020

Documentation icon Template documentation[view] [edit] [history] [purge]Pages that link to Template:Box

Usage

Recommended usage: {{Box|''Contents''}}

Parameters

#/Name Optional Description Default
1 Yes Small image on the left shrunk to 40×40 pixels. File:notice.svg
2 No Text, if this parameter isn't set, uses the first parameter as text.
3 Yes Color of the box. When transparent it does hide the border. #1e90ff    
type Yes Type of the box. Not set

It is possible to add additional rows by using {{!}} in the Text parameter. One example is {{SVG available}}.

Types

With types it is possible to predefine the image and color, although both can be changed.

Type Image Color
Not set or info Notice.svg    
error Ambox warning pn.svg    
warning Warning.svg    
note or notice Notice.svg    
disambig Disambig-dark.svg    

Examples

Box with a custom image and color, overriding the type.
 {{Box|Kerbin18.png|Box with a custom image and color, overriding the <tt>type</tt>.|#00bb00|type=error}}
Box with a custom image and color, no type set.
 {{Box|Kerbin18.png|Box with a custom image and color, no <tt>type</tt> set.|#00bb00}}
Box with a custom image, no color set.
 {{Box|Kerbin18.png|Box with a custom image, no color set.}}
Box with type set to warning.
 {{Box|type=warning|Box with <tt>type</tt> set to <tt>warning</tt>.}}
Box with default settings.
 {{Box|Box with default settings.}}

Additional Box templates