From Brotato Wiki

m (fix maxwidth rendering as `{{{maxwidth}}}` when not set)
(Add templatedata, and update the {{{1|}}} to be {{{name|{{{1|}}}}}}}}} (as this is required to use templatedata without breaking things))
Line 2: Line 2:
--><div class="iconbox" 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{{{rarity|{{Rarity|{{{1}}}}}}}} rounded relative"><!--
--><div class="rarity{{{rarity|{{Rarity|{{{name|{{{1|}}}}}}}}}}} rounded relative"><!--
-->[[File:{{{image|{{{1}}}}}}.png|{{{size|60px}}}|link={{{1}}}|{{{1}}}]]<!--
-->[[File:{{{image|{{{name|{{{1|}}}}}}}}}.png|{{{size|60px}}}|link={{{name|{{{1|}}}}}}|{{{name|{{{1|}}}}}}]]<!--
-->{{#if:{{{amount|}}}|<!--
-->{{#if:{{{amount|}}}|<!--
--><span class="iconamount">{{{amount}}}</span><!--
--><span class="iconamount">{{{amount}}}</span><!--
Line 18: Line 18:
-->{{#if:{{{caption|}}}|<!--
-->{{#if:{{{caption|}}}|<!--
CAPTION: CUSTOM
CAPTION: CUSTOM
-->[[{{{1}}}|<strong>{{{caption}}}</strong>]]|<!--
-->[[{{{name|{{{1|}}}}}}|<strong>{{{caption}}}</strong>]]|<!--
CAPTION: AUTO
CAPTION: AUTO
-->[[{{{1}}}|<strong>{{{1}}}</strong>]]<!--
-->[[{{{name|{{{1|}}}}}}|<strong>{{{name|{{{1|}}}}}}</strong>]]<!--
-->}}<!--
-->}}<!--
-->}}<!--
-->}}<!--
Line 77: Line 77:




</noinclude>
<templatedata>
{
"params": {
"maxwidth": {
"label": "Max Width",
"description": "If set, constrains the box to the specified width. Accepts any valid CSS width (60px, 60%). If not set, uses max-width:auto.",
"example": "60px",
"type": "string",
"suggested": true
},
"rarity": {
"label": "Rarity",
"description": "Options: -1, 1, 2, 3, 4",
"type": "number",
"suggested": true
},
"name": {
"aliases": [
"1"
],
"label": "Name",
"description": "Name of the character/item/weapon",
"type": "string",
"required": true,
"suggested": true
},
"image": {
"label": "Image Override",
"description": "If not set, uses the image that matches the name",
"type": "string",
"suggested": true
},
"size": {
"label": "Size",
"description": "Size with px, eg. \"30px\"",
"type": "string",
"suggested": true
},
"amount": {
"label": "Amount",
"description": "Shows a number on the bottom right corner",
"type": "number"
},
"top": {
"label": "Top Text",
"description": "Shown above the caption",
"suggested": true
},
"nobr": {
"label": "Prevent Line Breaks?",
"description": "If enabled, removes the line break, putting the icon and text on a single line",
"type": "boolean",
"suggested": true
},
"caption": {
"label": "Caption Override",
"description": "If not set, uses the specified name. Always links to the name. Use \"no\" to hide the caption",
"type": "string",
"suggested": true
}
},
"paramOrder": [
"name",
"rarity",
"size",
"amount",
"image",
"caption",
"top",
"nobr",
"maxwidth"
]
}
</templatedata></noinclude>

Revision as of 21:24, 7 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|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

Numbersuggested
Sizesize

Size with px, eg. "30px"

Stringsuggested
Amountamount

Shows a number on the bottom right corner

Numberoptional
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

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:auto.

Example
60px
Stringsuggested