From Brotato Wiki

(add templatedata for new inline option)
(add option for nolink=1 -- this can be used to show Iconbox on mod pages whose items shouldn't link anywhere)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly><!--
<includeonly><!--
--><span class="iconbox {{#ifeq:{{{inline|}}}|1|iconbox--inline|}}" style="display:inline-block;{{#if:{{{maxwidth|}}}|max-width:{{{maxwidth}}}|max-width:initial;}}"><!--
--><div class="iconbox" style="display:inline-block;{{#if:{{{maxwidth|}}}|max-width:{{{maxwidth}}}|max-width:initial;}}"><!--
ICON
ICON
--><div class="rarity<!--
--><div class="rarity<!--
     -->{{#ifeq:{{{rarity|}}}|auto|{{GetRarity|{{{name|{{{1|}}}}}}}}|{{{rarity|{{Rarity|{{{name|{{{1|}}}}}}}}}}}}}<!--
     -->{{#ifeq:{{{rarity|}}}|auto|{{GetRarity|{{{name|{{{1|}}}}}}}}|{{{rarity|{{Rarity|{{{name|{{{1|}}}}}}}}}}}}}<!--
     --> rounded relative"><!--
     --> rounded relative"><!--
-->[[File:{{{image|{{{name|{{{1|}}}}}}}}}.png|{{{size|60px}}}|link={{{name|{{{1|}}}}}}|{{{name|{{{1|}}}}}}]]<!--
IMAGE
-->{{#ifeq:{{{nolink|}}}|1|<!--
No image link:
-->[[File:{{{image|{{{name|{{{1|}}}}}}}}}.png|{{{size|60px}}}]]|<!--
            Has image link:
-->[[File:{{{image|{{{name|{{{1|}}}}}}}}}.png|{{{size|60px}}}|link={{{name|{{{1|}}}}}}|{{{name|{{{1|}}}}}}]]<!--
-->}}<!--
AMOUNT
-->{{#if:{{{amount|}}}|<!--
-->{{#if:{{{amount|}}}|<!--
--><span class="iconamount">{{{amount}}}</span><!--
--><span class="iconamount">{{{amount}}}</span><!--
Line 18: Line 25:
-->{{#ifeq:{{{caption}}}|no|<!--no caption-->|<!--
-->{{#ifeq:{{{caption}}}|no|<!--no caption-->|<!--
-->{{#ifeq:{{{nobr}}}|1|<!--empty space (nobr)-->&nbsp;&nbsp;|<br>}}<!--
-->{{#ifeq:{{{nobr}}}|1|<!--empty space (nobr)-->&nbsp;&nbsp;|<br>}}<!--
-->{{#if:{{{caption|}}}|<!--
-->{{#ifeq:{{{nolink|}}}|1|<!--
CAPTION: CUSTOM
LINK: No
-->[[{{{name|{{{1|}}}}}}|<strong>{{{caption}}}</strong>]]|<!--
-->{{#if:{{{caption|}}}|<!--
CAPTION: AUTO
CAPTION: Custom
-->[[{{{name|{{{1|}}}}}}|<strong>{{{name|{{{1|}}}}}}</strong>]]<!--
--><strong>{{{caption}}}</strong><!--
-->}}<!--
                    -->|<!--
CAPTION: Auto
--><strong>{{{name|{{{1|}}}}}}</strong><!--
-->}}<!--
-->|<!--
LINK: Yes
-->{{#if:{{{caption|}}}|<!--
CAPTION: Custom
-->[[{{{name|{{{1|}}}}}}|<strong>{{{caption}}}</strong>]]<!--
                    -->|<!--
CAPTION: Auto
-->[[{{{name|{{{1|}}}}}}|<strong>{{{name|{{{1|}}}}}}</strong>]]<!--
-->}}<!--
-->}}<!--
-->}}<!--
-->}}<!--
--></span><!--
--></div><!--
--></includeonly><noinclude>
--></includeonly><noinclude>


Line 64: Line 84:
|<code><nowiki>{{Iconbox|Acid|rarity=auto}}</nowiki></code>
|<code><nowiki>{{Iconbox|Acid|rarity=auto}}</nowiki></code>
|{{Iconbox|Acid|rarity=auto}}
|{{Iconbox|Acid|rarity=auto}}
|-
|<code><nowiki>{{Iconbox|Acid|nolink=1}}</nowiki></code>
|{{Iconbox|Acid|nolink=1}}
|-
|<code><nowiki>{{Iconbox|Acid|image=Tree}}</nowiki></code>
|{{Iconbox|Acid|image=Tree}}
|-
|-
|<code><nowiki>{{Iconbox|Acid|size=30px}}</nowiki></code>
|<code><nowiki>{{Iconbox|Acid|size=30px}}</nowiki></code>
Line 73: Line 99:
|<code><nowiki>{{Iconbox|Acid|size=30px|nobr=1|top=Foobar}}</nowiki></code>
|<code><nowiki>{{Iconbox|Acid|size=30px|nobr=1|top=Foobar}}</nowiki></code>
|{{Iconbox|Acid|size=30px|nobr=1|top=Foobar}}
|{{Iconbox|Acid|size=30px|nobr=1|top=Foobar}}
|-
|<code><nowiki>{{Iconbox|Acid|size=30px|nobr=1|inline=1}}</nowiki></code>
|Inline option makes {{Iconbox|Acid|size=30px|nobr=1|inline=1}} work in a sentence.
|}
|}


Line 126: Line 149:
"label": "Amount",
"label": "Amount",
"description": "Shows a number on the bottom right corner",
"description": "Shows a number on the bottom right corner",
"type": "number"
"type": "number",
"suggested": true
},
},
"top": {
"top": {
Line 144: Line 168:
"type": "string",
"type": "string",
"suggested": true
"suggested": true
},
"inline": {
"label": "Inline?",
"description": "If enabled, removes top/bottom margin, allowing Iconbox to be used among other text, eg. inside a sentence. Use 1 to enable",
"type": "boolean"
}
}
},
},
Line 160: Line 179:
"top",
"top",
"nobr",
"nobr",
"inline",
"maxwidth"
"maxwidth"
]
]
}
}
</templatedata></noinclude>
</templatedata></noinclude>

Latest revision as of 21:10, 14 November 2022


Usage

This template can be used by entering the following onto a relevant page. Do not use this on your user page. It is reserved for content pages.

{{Iconbox|Acid|size=30px|caption=caption|amount=1|rarity=1}}

Examples

Code Preview
{{Iconbox|Acid}}
{{Iconbox|Acid|amount=1}}
{{Iconbox|Acid|caption=Foobar}}
{{Iconbox|Acid|caption=no}}
Acid
{{Iconbox|Acid|top=Foobar}}
Acid

Foobar
Acid
{{Iconbox|Acid|rarity=-1}}


{{Iconbox|Acid|rarity=1}}
{{Iconbox|Acid|rarity=2}}
{{Iconbox|Acid|rarity=3}}
{{Iconbox|Acid|rarity=4}}
{{Iconbox|Acid|rarity=5}}

{{Iconbox|Acid|rarity=auto}}
{{Iconbox|Acid|nolink=1}}
Acid.png

Acid
{{Iconbox|Acid|image=Tree}}
{{Iconbox|Acid|size=30px}}
{{Iconbox|Acid|size=30px|nobr=1}}
Acid
  Acid
{{Iconbox|Acid|size=30px|nobr=1|top=Foobar}}
Acid
  Foobar  Acid

Other Options

The maxwidth option lets you restrain text that would otherwise be very long:

{{Iconbox|Acid|size=60px|top=This text is quite long but maxwidth restrains it|maxwidth=120px}}

Acid

This text is quite long but maxwidth restrains it
Acid


No description.

Template parameters

ParameterDescriptionTypeStatus
Namename 1

Name of the character/item/weapon

Stringrequired
Rarityrarity

Options: -1, 1, 2, 3, 4, auto

Numbersuggested
Sizesize

Size with px, eg. "30px"

Stringsuggested
Amountamount

Shows a number on the bottom right corner

Numbersuggested
Image Overrideimage

If not set, uses the image that matches the name

Stringsuggested
Caption Overridecaption

If not set, uses the specified name. Always links to the name. Use "no" to hide the caption

Stringsuggested
Top Texttop

Shown above the caption

Unknownsuggested
Prevent Line Breaks?nobr

If enabled, removes the line break, putting the icon and text on a single line. Use 1 to enable

Booleansuggested
Max Widthmaxwidth

If set, constrains the box to the specified width. Accepts any valid CSS width (60px, 60%). If not set, uses max-width:initial.

Example
60px
Stringsuggested