Template:Item
This template displays a link to an item along with an image of it in the front. It is highly versatile and can handle virtually any entity – not just items, but also NPCs, enemies, biomes, etc.
Usage
{{ item | <name> | <displaytext> | t = <custom displaytext override> | mode = image/table/text | rowspan = <number> | image = <image file name(s)> | size = <image size(s)> | scale = <image scale(s)> | maxsize = <image size limit> | ext = <file extension> | link = <link target> | nolink = y/yes | note = <note text> | note2 = <alternative note text> | bignote = <text after item name> | wrap = y/yes | icons = n/no/y/yes/<custom> | small = y/yes | id = <data ID> | type = <ID type> | showid = y/yes/n/no | anchor = y/yes | class = <CSS class(es)> | css/style = <CSS styling> }}
See the examples below for more details.
- First unnamed parameter
Name of the entity. Link and image will be set automatically; e.g. for Wood
, the link will also be Wood
and the image will be Wood.png
(.png
is the default file extension and can be adjusted with $ext
). If omitted, it will be automatically determined from the parameter $id
.
- Second unnamed parameter
Custom link text, which can include other wikitext, like line breaks (<br/>
) and custom links. This parameter can also be used to convert the entity name to plural by setting it to s
. The plural conversion is mostly intuitive, as it can handle cases like Safe
→Safes
and Knife
→Knives
, but probably not all edge cases. The parameter value es
will simply be appended to the entity name. Lastly, this parameter will automatically be translated in non-English wikis (just like the first unnamed parameter).
- t
Custom link text, overrides the second unnamed parameter. It will be displayed as-is, which can be useful to override the plural conversion and translation that the second parameter applies automatically.
- mode
Display mode. By default, the output will consist of an image and text. With this parameter that can be changed:
image
: Displays only the image and no text. (Aliases for this mode:imageonly
,onlyimage
. These are deprecated; do not use them.)text
: Displays only the text and no image. (Alias for this mode:noimage
. This is deprecated; do not use it.)table
: Displays two cells for a table. It is roughly a shortcut for{{item|mode=image|name}} || {{item|mode=text|name}}
. (Alias for this mode:2-cell
. This is deprecated; do not use it.)
- rowspan
Only valid together with |mode=table
. Defines how many table rows will be occupied; the default is 1
like any regular table row.
- image
File name of the image, without the brackets and File:
, but with the file extension. For example, to display File:Wood.png, use | image = Wood.png
. Multiple images can also be specified by separating them with slashes (/
), e.g. | image = Wood.png / Gel.png
.
A completely custom image display can also be achieved by specifying the full syntax, e.g. | image = [[File:Wood.png]]
. This is only to be used if the normal method is not sufficient. Resizing via $size
and $scale
is not possible this way, and must be done within the [[File:
code itself, e.g. | image = [[File:Wood.png|30px]]
.
- size
Size of the image. Three types of syntax are supported:
<width>px
: Scales the image to make it the specified number of pixels in width, and scales the height to retain the original aspect ratio.x<height>px
: Scales the image to make it the specified number of pixels in height, and scales the width to retain the original aspect ratio.<width>x<height>px
: Scales the image to be no wider and no higher than the specified number of pixels. The image will keep its original aspect ratio.
A scaling factor can be appended to each of these formats via an asterisk (*
), e.g.:
12px *3
→36px
x50px *0.5
→x25px
42x30px *2
→84x60px
Enlarging an image beyond its original size (disregarding scaling factors) is not possible with the second format, x<height>px
; only the other two formats can be used in that case. This is the same limitation as in the regular [[File:
syntax.
Multiple sizes can be specified by separating them with slashes (/
). They will be matched to the images:
- If the images and sizes match, they will each be resized accordingly.
- Example:
| image = A.png / B.png / C.png | size = 10px / 20px / 30px
→A.png|10px
,B.png|20px
,C.png|30px
- Example:
- If exactly one size is specified, all images will be resized.
- Example:
| image = A.png / B.png / C.png | size = x50px
→A.png|x50px
,B.png|x50px
,C.png|x50px
- Example:
- If more than one size is specified, but not enough for all images, then the rest of the images will not be resized at all.
- Example:
| image = A.png / B.png / C.png | size = 10px*2 / 12x14px
→A.png|10px*2
,B.png|12x14px
,C.png
- Example:
- If more sizes than images are specified, then the rest of the sizes are simply ignored.
- Example:
| image = A.png / B.png / C.png | size = 10px / 20px / 30px / 40px / 50px
→A.png|10px
,B.png|20px
,C.png|30px
- Example:
- scale
Scaling factor for the image sizes. It works just like the factor within $size
, so e.g. | size = 42x30px | scale = 2
results in a size of 84x60px
. If $size
is not specified, it just scales the original dimensions of the image(s). If multiple sizes are specified in $size
, then the scaling factor is applied to all of them.
The $size
parameter can also already include a scaling factor. For example, | size = 15px*2 | scale = 3
results in a size of 15px * 2 * 3 = 90px
. The factors could also cancel each other out, e.g. via | size = 20px*0.5 | scale = 2
.
- maxsize
Limits the image size, applied after scaling. The same three formats as for $size
are supported (except for the appended factor) and the same matching to images. This parameter is useful for multiple images with different sizes. For example, with | image = Sunflower (placed).png / Wood.png / Gel.png
, the first image is quite tall compared to the others. A | maxsize = x18px
could be used to limit the height, perhaps to not make the images stand out too much within a paragraph, without enlarging the other two images which are already small enough.
- ext
File extension of the default image. This saves some typing, e.g. {{item|Soul of Light|ext=gif}}
instead of {{item|Soul of Light|image=Soul of Light.gif}}
. The parameter has no effect if $image
is specified.
- link
Changes the link target of the text and image. The platform icons are also based on this parameter, if it is specified. A blank value ({{item|link=}}
) is identical to |nolink=yes
. This parameter has no effect if nolink=yes
is specified.
- nolink
Suppresses the entity link; the name will be displayed without a link instead. This parameter overrides any $link
input.
- note
Short, supplementary note text. It will be displayed as small, gray text between the entity name/link and the platform icons.
- note2
Short, supplementary note text. Unlike $note
, it will be displayed in normal size and always on its own line.
- bignote
Short, supplementary note text. It will always be displayed as its own block after the entity name/link, $note
, and platform icons. It is a good location for adding <ref>
tags or {{footnote}}
s.
- wrap
Pushes the $note
and platform icons to their own lines. The icons will automatically be made small (as if | small = yes
was set). This parameter has no effect if $id
or $note2
is specified, because those texts always occupy their own line and there usually would not be enough space for another line.
- icons
By default, platform icons are displayed for the entity named in $link
or the first unnamed parameter. The value n
or no
suppresses them; the value y
or yes
forcibly displays them (if they were suppressed by some other manner, i.e. options). The parameter can also be set to completely custom {{eicons}}
. The parameter must not be set to anything else other than n
/no
, y
/yes
, or a transclusion of {{eicons}}
.
- small
Reduces the size of the platform icons (useful when space is an issue). The icons will automatically be shrunk if $wrap
, $id
, or $note2
are specified – |small=y
is redundant in those cases.
- id
ID of the entity, displayed below its name. If the first unnamed parameter is omitted, this parameter will automatically determine the ID. For example, {{item|id=1}}
will automatically be converted to {{item|Iron Pickaxe|id=1}}
(the item with ID 1 is the Iron Pickaxe). The parameter $type
is taken into consideration for this, e.g. {{item|id=4|type=npc}}
will automatically be converted to {{item|Eye of Cthulhu|id=4|type=npc}}
(the NPC with ID 4 is the Eye of Cthulhu).
- type
Type of the ID, only has an effect if $id
or $showid
is specified. The following values are recognized (case-insensitive):
The default is item
and all unrecognized values are treated as item
.
The automatic conversion of IDs to entity names described above for $id
depends on the existence of a template named <type>NameFromId
. For instance, with {{item|id=4|type=npc}}
the Template:NpcNameFromId will be consulted like so: {{npcNameFromId|4}}
→ Eye of Cthulhu
. If no such template exists for the specified $type
(e.g. Template:ArmorNameFromId with |type=armor
or Template:WeaponNameFromId with |type=weapon
), then {{item}}
will produce unusable output.
- showid
Toggles the display of the entity's ID. By default, the ID is only displayed if $id
is specified. If $id
is not specified, the ID will be determined automatically. For example, {{item|Iron Pickaxe|showid=yes}}
will automatically be converted to {{item|Iron Pickaxe|id=1}}
. The parameter $type
is taken into consideration for this, e.g. {{item|Eye of Cthulhu|showid=yes|type=npc}}
will automatically be converted to {{item|Eye of Cthulhu|id=4|type=npc}}
.
Analogous to above, this automatic conversion depends on the existence of a template named <type>IdFromName
. For instance, with {{item|Eye of Cthulhu|showid=yes|type=npc}}
the Template:NpcIdFromName will be consulted like so: {{npcIdFromName|Eye of Cthulhu}}
→ 4
. If no such template exists for the specified $type
(e.g. Template:ArmorIdFromName with |type=armor
or Template:WeaponIdFromName with |type=weapon
), then an error will be displayed.
- anchor
Creates an HTML anchor with the name of the first unnamed parameter. On language wikis, two anchors are created: One with the name of the first unnamed parameter ($1
) and one with its translation ({{tr|$1}}
). Linking from the table of contents is not supported; use {{anchor|toc=yes}}
for that.
- class
Custom CSS classes. While these can be completely custom, there are also some predefined classes available (see examples below):
Multiple classes can be applied at the same time, separated by spaces (e.g. |class=boldname notecolor
).
- css/style
Custom styling rules.
Examples
Common
Basic and common usage.
Code | Result |
---|---|
{{item|Wood}} |
![]() |
{{item|Wood|Any Wood}} |
![]() |
{{item|Wood|s}} |
![]() |
{{item|Wood|link=Trees}} |
![]() |
{{item|Wood|image=Stone Block.png}} |
![]() |
{{item|Wood|mode=image}} |
![]() |
{{item|Wood|mode=image|image=Wood.png / Boreal Wood.png}} |
![]() ![]() |
{{item|Ash Wood|wrap=y}} |
![]() |
{{item|Ash Wood|icons=no}} |
![]() |
{{item|Wood|scale=0.7}} |
![]() |
{{item|Wood|note=(from trees)}} |
![]() |
{{item|Wood|note2=(from trees)}} |
![]() |
Type
Numerous types of entities apart from items.
Code | Result |
---|---|
{{item|Iron Pickaxe}} |
![]() |
{{item|Blue Slime}} |
![]() |
{{item|Bee Mount}} |
![]() |
{{item|On Fire!}} |
![]() |
{{item|Pet Lizard}} |
![]() |
{{item|Phantasmal Deathray}} |
![]() |
{{item|The Underworld}} |
![]() |
{{item|Frost Moon}} |
![]() |
{{item|Christmas}} |
![]() |
Name and displaytext
Custom displaytext, automatic plural forms, overriding them.
Code | Result |
---|---|
{{item|Stone Block}} |
![]() |
{{item|Stone Block|Blocks}} |
![]() |
{{item|Stone Block|s}} |
![]() |
{{item|Safe|s}} |
![]() |
{{item|Throwing Knife|s}} |
![]() |
{{item|Butterfly|s}} |
![]() |
{{item|Eye Patch|s}} |
![]() |
{{item|'S' Statue|s}} |
![]() |
{{item|'S' Statue|t=s}} |
![]() |
{{item|Wood|Any [[Wood]]}} |
![]() |
{{item|Breaker Blade|'''Big'''<br/>[[sword]]}} text can be vertically centered with |class=multi-line |
![]() sword |
Link
Custom link target, unlinking.
Code | Result |
---|---|
{{item|Iron Pickaxe|link=Pickaxes}} |
![]() |
{{item|Iron Pickaxe|nolink=y}} |
![]() |
{{item|Iron Pickaxe|link=}} |
![]() |
{{item|Iron Pickaxe|link=Pickaxes|nolink=y}} |
![]() |
Note: Using the first unnamed parameter just to set the image is not recommended (because the hovertext of the image will be misleading). Use the $image
parameter instead.
Code | Result |
---|---|
{{item|Iron Pickaxe|Pickaxes|link=Pickaxes}} not recommended |
![]() |
{{item|Pickaxes|image=Iron Pickaxe.png}} recommended |
![]() |
{{item|Iron Pickaxe|Digging tools|link=Pickaxes}} not recommended |
![]() |
{{item|Digging tools|link=Pickaxes|image=Iron Pickaxe.png}} recommended |
![]() |
Image
Custom images, file extension.
Code | Result |
---|---|
{{item|Torch|image=Ice Torch.png}} |
![]() |
{{item|Torches|image=Yellow Torch.png / Green Torch.png / Blue Torch.png}} |
![]() ![]() ![]() |
{{item|Guide|image=Guide.png / Guide (Shimmered).png}} |
![]() ![]() |
{{item|Sandstone Brick|image=Sandstone Brick (placed).png}} |
![]() |
{{item|Bottle|image=Bottle.png / Bottle (placed).png}} |
![]() ![]() |
{{item|Goblin Tinkerer|image=[[File:Bound Goblin.png]] → [[File:Goblin Tinkerer.png]]}} completely custom image code, at least one [[File: must be present |
![]() ![]() |
{{item|Soul of Night|image=Soul of Night.gif}} |
![]() |
{{item|Soul of Night|ext=gif}} |
![]() |
{{item|Soul of Night|image=Soul of Night.gif / Soul of Light.gif}} |
![]() ![]() |
{{item|Treasure Bag|s|ext=gif}} |
![]() |
Size and scale
Resizing images.
Code | Result |
---|---|
{{item|Beach Ball}} original size: 50×50 pixels |
![]() |
{{item|Beach Ball|size=25px}} effective size: 25×25 pixels |
![]() |
{{item|Beach Ball|size=25x100px}} effective size: 25×25 pixels |
![]() |
{{item|Beach Ball|size=30px*0.5}} effective size: 15×15 pixels |
![]() |
{{item|Beach Ball|scale=0.5}} effective size: 25×25 pixels |
![]() |
{{item|Beach Ball|size=100px*0.2|scale=3}} effective size: 60×60 pixels |
![]() |
{{item|Beach Ball|maxsize=25px}} effective size: 25×25 pixels |
![]() |
{{item|Beach Ball|maxsize=100px}} effective size: 50×50 pixels |
![]() |
{{item|Clown}} original size: 58×98 pixels |
![]() |
{{item|Clown|size=x40px}} effective size: 23×40 pixels |
![]() |
{{item|Clown|scale=0.5}} effective size: 29×49 pixels |
![]() |
{{item|Clown|size=x120px}} effective size: 58×98 pixels (attempting to enlarge with this syntax has no effect; the following must be used instead) |
![]() |
{{item|Clown|size=71x120px}} or {{item|Clown|size=71px}} effective size: 71×120 pixels |
![]() |
Size and scale (multiple)
Resizing multiple images.
Code | Result |
---|---|
{{item|Furnace|image=Furnace.png / Furnace (placed).gif}} original sizes: 30×26 pixels, 46×34 pixels |
![]() ![]() |
{{item|Furnace|image=Furnace.png / Furnace (placed).gif|size=20px}} effective sizes: 20×17 pixels, 20×15 pixels |
![]() ![]() |
{{item|Furnace|image=Furnace.png / Furnace (placed).gif|size=20px / 30px}} effective sizes: 20×17 pixels, 30×22 pixels |
![]() ![]() |
{{item|Furnace|image=Furnace.png / Furnace (placed).gif|size=20px / 30px / 40px}} effective sizes: 20×17 pixels, 30×22 pixels |
![]() ![]() |
{{item|Furnace|image=Furnace.png / Furnace (placed).gif / Furnace.png|size=20px / 30px}} effective sizes: 20×17 pixels, 30×22 pixels, 30×26 pixels |
![]() ![]() ![]() |
Platform icons
Controlling the appearance of platform icons, custom icons.
Code | Result |
---|---|
{{item|Zenith}} |
![]() |
{{item|Zenith|small=y}} |
![]() |
{{item|Zenith|wrap=y}} |
![]() |
{{item|Zenith|icons=n}} |
![]() |
{{item|Zenith|icons={{eicons|Ocram}}}} |
![]() |
Template:Eicons also has a $small
parameter, but it has no effect when used within {{item}}
. Use {{item}}
's own parameter for that.
Code | Result |
---|---|
{{item|Zenith|icons={{eicons|Ocram|small=y}}}} icons are not small |
![]() |
{{item|Zenith|small=y|icons={{eicons|Ocram}}}} icons are small |
![]() |
Note text
Various forms of supplementary text.
Code | Result |
---|---|
{{item|Healing Potion}} |
![]() |
{{item|Healing Potion|note=(rare)}} |
![]() |
{{item|Healing Potion|note=restores health}} |
![]() |
{{item|Healing Potion|note=restores health|wrap=y}} |
![]() |
{{item|Healing Potion|note2=restores health}} |
![]() |
{{item|Healing Potion|bignote=restores health}} |
![]() |
{{item|Healing Potion|bignote={{footnote|If [[Greater Healing Potion]]s are unavailable.}}}} |
![]() |
All three note parameters can be used at the same time. Avoid this if possible, as it is rather cluttered.
Code | Result |
---|---|
{{item|Healing Potion|note=(rare)|note2=restores health|bignote={{footnote|If [[Greater Healing Potion]]s are unavailable.}}}} |
![]() |
The $note2
will always be on its own line. If it is present, then |wrap=y
has no effect.
Code | Result |
---|---|
{{item|Healing Potion|note=(rare)|wrap=y}} |
![]() |
{{item|Healing Potion|note=(rare)|wrap=y|note2=restores health}} |
![]() |
ID
Displaying data IDs, different types of IDs, displaying entities by their IDs.
Code | Result |
---|---|
{{item|Silver Coin}} |
![]() |
{{item|Silver Coin|showid=y}} |
![]() |
{{item|id=72}} displaying an item by its ID |
![]() |
{{item|id=72|showid=n}} the ID is displayed by default when $id is used and must be disabled explicitly if desired |
![]() |
{{item|id=72|showid=n|t=Item 72}} |
![]() |
{{item|Coins|image=Silver Coin.png|id=71–74}} |
![]() |
For entities that are not items, $type
must be specified.
Code | Result |
---|---|
{{item|Venom Bullet|showid=y}} |
![]() |
{{item|Venom Bullet|id=283|type=projectile}} |
![]() |
{{item|Venom Bullet|id=283|type=projectile|image=Venom Bullet (projectile).png}} |
![]() |
{{item|Goblin Scout|showid=y}} |
![]() |
{{item|Goblin Scout|showid=y|type=npc}} |
![]() |
{{item|type=npc|id=73}} |
![]() |
{{item|Molten Breastplate|id=9|type=armor}} |
![]() |
Use {{buff}}
to display buffs and debuffs. It uses {{item}}
internally but is optimized for buffs and debuffs.
Combined platform icons, note text, and ID
Effect of |wrap=y
in different constellations.
Code | Result |
---|---|
{{item|Lava Lamp|wrap=y}} icons and no note: icons will wrap to the next line |
![]() |
{{item|Lava Lamp|wrap=y|note=(furniture)}} icons and note: note will wrap to the next line |
![]() |
{{item|Lava Lamp|wrap=y|note=(furniture)|icons=n}} note and no icons: note will wrap to the next line |
![]() |
{{item|Lava Lamp|wrap=y|note=(furniture)|showid=y}} ID visible: |wrap=y has no effect, note and icons are always on the first line and icons are always small |
![]() |
{{item|Lava Lamp|wrap=y|note=(furniture)|note2=from Party Girl}} same for $note2 |
![]() |
{{item|Lava Lamp|wrap=y|note=(furniture)|note2=from Party Girl|showid=y}} ID and $note2 will each always occupy their own line |
![]() |
Anchor
Creating the anchor, linking to it.
Code | Result |
---|---|
{{item|Wood Wall|image=Wood Wall (placed).png|anchor=y}} |
![]() |
Jump to [[#Wood Wall|the Wood Wall on this page]] |
Jump to the Wood Wall on this page |
[[Template:Item#Wood Wall]] |
Template:Item#Wood Wall |
Mode of display
Image-only, text-only, tabular, spanning multiple table rows.
Code | Result | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
{{item|Dart Rifle|showid=y|note=(requires darts)}} |
![]() | ||||||||||
{{item|Dart Rifle|mode=image|showid=y|note=(requires darts)}} |
![]() | ||||||||||
{{item|Dart Rifle|mode=text|showid=y|note=(requires darts)}} |
Dart Rifle(requires darts)(Desktop, Console and Mobile versions)Internal Item ID: 3008 | ||||||||||
{| class="terraria lined" ! Image !! Name |- | {{item|mode=table|Dart Rifle|showid=y|note=(requires darts)}} |- | {{item|mode=table|Poison Dart|s}} |} |
| ||||||||||
{| class="terraria lined" ! Image !! Name !! Notes |- | {{item|mode=table|Dart Rifle|showid=y|note=(requires darts)}} || Weapon |- | {{item|mode=table|Poison Dart|s|rowspan=2}} || Ammunition |- | Requires weapon |} |
|
Custom styling
Styling with CSS.
Code | Result |
---|---|
{{item|Princess|showid=y|type=npc|note=with Resonance Scepter|note2=(town NPC)}} |
![]() |
{{item|Princess|showid=y|type=npc|note=with Resonance Scepter|note2=(town NPC)|css=border: 2px solid var(--theme-box-border-color); background-color: var(--theme-text-background-color-highlight); padding: 5px;}} |
![]() |
{{item|Princess|showid=y|type=npc|note=with Resonance Scepter|note2=(town NPC)|css=color: var(--theme-text-color-green);}} |
![]() |
Class
Predefined classes, combining predefined classes with custom style rules.
boldname
Predefined class boldname
: displays the entity name in boldface.
Code | Result |
---|---|
{{item|Princess|class=boldname|showid=y|type=npc|note=with Resonance Scepter|note2=(town NPC)}} |
![]() |
{{item|Princess|class=boldname|nolink=y}} |
![]() |
{{item|Princess|class=boldname|nolink=y|css=color: var(--theme-text-color-note);}} |
![]() |
notecolor
Predefined class notecolor
: removes the gray color from the $note
text. It will be displayed in the normal, current text color, whatever that may be (via color: inherit
internally). For instance, setting a custom text color in $css
will then also affect the note text.
Code | Result |
---|---|
{{item|Princess|showid=y|type=npc|note=with Resonance Scepter|note2=(town NPC)|class=notecolor}} |
![]() |
{{item|Princess|showid=y|type=npc|note=with Resonance Scepter|note2=(town NPC)|class=notecolor|css=color: var(--theme-text-color-green);}} |
![]() |
There is also the predefined class note2color
for $note2
, but since $note2
has no special text color and already always uses the normal color anyways, using note2color
is redundant.
notesize, note2size
Predefined classes notesize
and note2size
: toggle the font size differences of the note texts. notesize
increases the font size of $note
to the regular size; note2size
reduces the font size of $note2
to the small size of the default $note
.
Code | Result |
---|---|
{{item|Princess|showid=y|type=npc|note=with Resonance Scepter|note2=(town NPC)|class=notesize}} both large |
![]() |
{{item|Princess|showid=y|type=npc|note=with Resonance Scepter|note2=(town NPC)|class=note2size}} both small |
![]() |
{{item|Princess|showid=y|type=npc|note=with Resonance Scepter|note2=(town NPC)|class=notesize note2size}} inversion of the default |
![]() |
alignleft, aligncenter, alignright
Predefined classes alignleft
, aligncenter
, and alignright
: change the alignment of the {{item}}
with respect to its surroundings, e.g. in a table cell.
Code | Result | ||||||||
---|---|---|---|---|---|---|---|---|---|
{| class="terraria lined" ! width=100 | Image !! Name |- | {{item|Princess|mode=table|showid=y|type=npc|note=with Resonance Scepter|note2=(town NPC)}} |} default alignment
|
| ||||||||
{| class="terraria lined" ! width=100 | Image !! Name |- | {{item|Princess|mode=table|showid=y|type=npc|note=with Resonance Scepter|note2=(town NPC)|class=alignleft}} |- | {{item|Princess|mode=table|showid=y|type=npc|note=with Resonance Scepter|note2=(town NPC)|class=aligncenter}} |- | {{item|Princess|mode=table|showid=y|type=npc|note=with Resonance Scepter|note2=(town NPC)|class=alignright}} |} |
|
textleft, textcenter, textright
Predefined classes textleft
, textcenter
, and textright
: change the alignment of the text parts within {{item}}
. In contrast with alignleft
etc., these classes have no effect on the alignment of the entire {{item}}
itself with respect to its surrounding text, or anything else outside of the {{item}}
. Therefore, the effect of these classes can only be seen when there are multiple lines within the {{item}}
.
Code | Result |
---|---|
{{item|Princess|showid=y|type=npc|note=with Resonance Scepter|note2=(town NPC)|class=textleft}} |
![]() |
{{item|Princess|showid=y|type=npc|note=with Resonance Scepter|note2=(town NPC)|class=textcenter}} |
![]() |
{{item|Princess|showid=y|type=npc|note=with Resonance Scepter|note2=(town NPC)|class=textright}} |
![]() |
block
Predefined class block
: changes the display
attribute of the {{item}}
from inline-block
(the default) to block
.
Code | Result |
---|---|
The item {{item|Gel}} is inline and the item {{item|Wood|class=block}} is not. |
The item ![]() ![]() |
allblock
Predefined class allblock
: similar to block
, but also sets display: block
on every element within {{item}}
. As a result, the image (or each image, if there are multiple) will be displayed on its own line. The class aligncenter
works well with allblock
.
Code | Result |
---|---|
{{item|Princess|class=allblock|showid=y|type=npc|note=with Resonance Scepter|note2=(town NPC)}} |
![]() |
{{item|Princess|class=allblock aligncenter}} |
![]() |
break
Predefined class break
: allows the entity name to be broken up into multiple lines if space is limited.
Code | Result |
---|---|
<div style="width: 8em; border: 1px solid var(--theme-box-border-color);">{{item|Pure Water Fountain|class=break}}</div> |
multi-line
Predefined class multi-line
: vertically centers the entity name when it occupies multiple lines. It also reduces the space between the lines.
Code | Result |
---|---|
{{item|Wall of Flesh|size=x64px}} entity name in one line: already vertically centered by default |
![]() |
{{item|Wall of Flesh|size=x64px|Wall of<br/>Flesh}} entity name over multiple lines: not vertically centered by default |
![]() Flesh |
{{item|Wall of Flesh|size=x64px|Wall of<br/>Flesh|class=multi-line}} entity name over multiple lines with multi-line class: vertically centered again |
![]() Flesh |
Transformations
Predefined classes mirror
, flip
, rotate90
, rotate180
, and rotate270
: transform the image accordingly. The transformations happen at the center of the image and its effective dimensions will retain the original values as if untransformed, so overlapping may occur under some circumstances. Note that only the first image is affected by these classes; use the custom mode of $image
with {{transform}}
for full control over all images.
Code | Result |
---|---|
{{item|Dryad}} |
![]() |
{{item|Dryad|class=mirror}} |
![]() |
{{item|Dryad|class=flip}} |
![]() |
{{item|Dryad|class=rotate90}} |
![]() |
{{item|Dryad|class=rotate180}} |
![]() |
{{item|Dryad|class=rotate270}} |
![]() |
{{item|Dryad|class=mirror|image=Dryad.png / Dryad.png / Dryad.png}} only the first image is affected |
![]() ![]() ![]() |
{{item|Dryad|image={{transform|[[File:Dryad.png]]|mirror=y}}[[File:Dryad (Shimmered).png]]{{transform|[[File:Dryad.png]]|mirror=y}}[[File:Dryad (Shimmered).png]]}} |
![]() ![]() |
Change default options
This template supports options through {{options}} template. All valid options are listed below, see {{options}} for usage and other infomation.
See Template:item/initOptions for the initial options setting of this template.
Name | Alias | Initial Value | Value Mapping[1] | Note |
---|---|---|---|---|
small | smallicons | (empty) | yes → y on → y n → (empty) no → (empty) off → (empty) | |
icons | (empty) | y → (empty) yes → (empty) on → (empty) no → n off → n | ||
anchor | (empty) | yes → y on → y n → (empty) no → (empty) off → (empty) | ||
mode | (empty) | |||
type | item | |||
wrap | (empty) | yes → y on → y n → (empty) no → (empty) off → (empty) | ||
nolink | (empty) | yes → y on → y n → (empty) no → (empty) off → (empty) | ||
class | (empty) | |||
css | style | (empty) | ||
scale | (empty) | |||
maxsize | (empty) | |||
showid | (empty) | yes → y on → y no → n off → n | No default value, will be automatically detected by other parameters. |
- ↑ Values with mapping will be stored and loaded as mapped value. Other values without mapping will be stored and loaded as-is.
NOTE: In order to avoid unwanted influences, it is very important to restore the options state as soon as possible, especially within other templates. Also use {{options/snap}}
and {{options/restore}}
.
See examples below for more details.
Examples
Code | Result |
---|---|
* {{item|Coin Ring}} * {{item|Gold Ring}} * {{item|Greedy Ring}} |
|
{{options/set|item|nolink=y}} * {{item|Coin Ring}} * {{item|Gold Ring}} * {{item|Greedy Ring}} {{options/reset|item}} |
|
{{options/set|item|small=y}} * {{item|Coin Ring}} * {{item|Gold Ring}} * {{item|Greedy Ring}} {{options/reset|item}} |
|
{{options/set|item|icons=n}} * {{item|Coin Ring}} * {{item|Gold Ring|icons=y}} * {{item|Greedy Ring}} {{options/reset|item}} options can be overridden individually
|
|
{{options/set|item|mode=image}} * {{item|Coin Ring}} * {{item|Gold Ring}} * {{item|Greedy Ring}} {{options/set|item|wrap=y|mode=text}} * {{item|Coin Ring}} * {{item|Gold Ring|mode=}} * {{item|Greedy Ring}} {{options/reset|item}} overriding an option back to the default
|
|
{{options/set|item|scale=0.5}} * {{item|Coin Ring}} * {{item|Gold Ring|size=*0.5}} * {{item|Greedy Ring}} {{options/reset|item}} the scaling factor in
$size (if present) is multiplied with the scaling factor from $scale |
|
{{options/set|item|maxsize=30x30px}} * {{item|Copper Coin}} * {{item|Breaker Blade}} * {{item|Clockwork Assault Rifle}} {{options/reset|item}} |
|
{{options/set|item|class=boldname}} * {{item|Coin Ring}} * {{item|Gold Ring}} * {{item|Greedy Ring}} {{options/reset|item}} |
|
About translation
{{item}}
is i18n-ready and has an integrated automatic translation. When translating a page from English to another language, e.g. Italian, it will often not be necessary to translate the transclusions of {{item}}
– the automatic translation will take care of it. For instance:
English page | Italian page | ||
---|---|---|---|
Code | Result | Code | Result |
{{item|Lucky Coin}} |
![]() |
{{item|Lucky Coin}} |
![]() |
If there is English text remaining or if the displaytext needs modification, then the first unnamed parameter should stay unchanged (because it is crucial for the image, link target, and platform icons) and the second unnamed parameter or $t
should be used. For instance:
English page | Italian page | ||
---|---|---|---|
Code | Result | Code | Result |
{{item|Coin Ring}} |
![]() |
{{item|Coin Ring}} |
![]() |
{{item|Coin Ring|Ring}} |
![]() |
{{item|Coin Ring|Anello}} |
![]() |
Notice how only the second unnamed parameter is translated to Italian (Ring
→ Anello
), not the first unnamed parameter (Coin Ring
). Translating both would be incorrect:
English page | Italian page | ||
---|---|---|---|
Code | Result | Code | Result |
{{item|Coin Ring|Ring}} |
![]() |
{{item|Anello di monete|Anello}} |
![]() |
The image and platform icons are broken, and the link is incorrect.
Footnotes
- ↑ If Greater Healing Potions are unavailable.
- ↑ If Greater Healing Potions are unavailable.