Template:Item

From Terraria Wiki
Jump to navigation Jump to search
This template uses Lua.
This template uses Module:Item, a script written in the Lua programming language. To learn more about Lua, see Terraria Wiki:Lua.
This template is i18n-ready, which means it is easy to localize for different languages. Please see I18n & l10n for templates to learn more.
This template uses the Cargo extension.
This template uses Extension:Cargo, an integral part of the wiki's back-end.
  • This template adds rows to the table "Imageinfo", which is declared by the template Image. View table.
Template-info.svg Documentation The documentation below is transcluded from Template:Item/doc. (edit | history)

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

This section formally describes all available parameters. See the examples below for just the common parameters and their combinations.

{{ 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 SafeSafes and KnifeKnives, 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 *336px
  • x50px *0.5x25px
  • 42x30px *284x60px

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 / 30pxA.png|10px, B.png|20px, C.png|30px
  • If exactly one size is specified, all images will be resized.
    • Example: | image = A.png / B.png / C.png | size = x50pxA.png|x50px, B.png|x50px, C.png|x50px
  • 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 / 12x14pxA.png|10px*2, B.png|12x14px, C.png
  • 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 / 50pxA.png|10px, B.png|20px, C.png|30px
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}} WoodWood
{{item|Wood|Any Wood}} WoodAny Wood
{{item|Wood|s}} WoodWoods
{{item|Wood|link=Trees}} WoodWood
{{item|Wood|image=Stone Block.png}} WoodWood
{{item|Wood|mode=image}} Wood
{{item|Wood|mode=image|image=Wood.png / Boreal Wood.png}} WoodWood
{{item|Ash Wood|wrap=y}} Ash WoodAsh Wood(Desktop, Console and Mobile versions)
{{item|Ash Wood|icons=no}} Ash WoodAsh Wood
{{item|Wood|scale=0.7}} WoodWood
{{item|Wood|note=(from trees)}} WoodWood(from trees)
{{item|Wood|note2=(from trees)}} WoodWood(from trees)

Type

Numerous types of entities apart from items.

Code Result
{{item|Iron Pickaxe}} Iron PickaxeIron Pickaxe
{{item|Blue Slime}} Blue SlimeBlue Slime
{{item|Bee Mount}} Bee MountBee Mount(Desktop, Console, Old-gen console and Mobile versions)
{{item|On Fire!}} On Fire!On Fire!
{{item|Pet Lizard}} Pet LizardPet Lizard
{{item|Phantasmal Deathray}} Phantasmal DeathrayPhantasmal Deathray
{{item|The Underworld}} The UnderworldThe Underworld
{{item|Frost Moon}} Frost MoonFrost Moon
{{item|Christmas}} ChristmasChristmas

Name and displaytext

Custom displaytext, automatic plural forms, overriding them.

Code Result
{{item|Stone Block}} Stone BlockStone Block
{{item|Stone Block|Blocks}} Stone BlockBlocks
{{item|Stone Block|s}} Stone BlockStone Blocks
{{item|Safe|s}} SafeSafes
{{item|Throwing Knife|s}} Throwing KnifeThrowing Knives
{{item|Butterfly|s}} ButterflyButterflies
{{item|Eye Patch|s}} Eye PatchEye Patches
{{item|'S' Statue|s}} 'S' Statue'S' Statues
{{item|'S' Statue|t=s}} 'S' Statues
{{item|Wood|Any [[Wood]]}} WoodAny Wood
{{item|Breaker Blade|'''Big'''<br/>[[sword]]}}
text can be vertically centered with |class=multi-line
Breaker BladeBig
sword

Link

Custom link target, unlinking.

Code Result
{{item|Iron Pickaxe|link=Pickaxes}} Iron PickaxeIron Pickaxe
{{item|Iron Pickaxe|nolink=y}} Iron PickaxeIron Pickaxe
{{item|Iron Pickaxe|link=}} Iron PickaxeIron Pickaxe
{{item|Iron Pickaxe|link=Pickaxes|nolink=y}} Iron PickaxeIron Pickaxe

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
Iron PickaxePickaxes
{{item|Pickaxes|image=Iron Pickaxe.png}}
recommended
PickaxesPickaxes
{{item|Iron Pickaxe|Digging tools|link=Pickaxes}}
not recommended
Iron PickaxeDigging tools
{{item|Digging tools|link=Pickaxes|image=Iron Pickaxe.png}}
recommended
Digging toolsDigging tools

Image

Custom images, file extension.

Code Result
{{item|Torch|image=Ice Torch.png}} TorchTorch
{{item|Torches|image=Yellow Torch.png / Green Torch.png / Blue Torch.png}} TorchesTorchesTorchesTorches
{{item|Guide|image=Guide.png / Guide (Shimmered).png}} GuideGuideGuide
{{item|Sandstone Brick|image=Sandstone Brick (placed).png}} Sandstone BrickSandstone Brick
{{item|Bottle|image=Bottle.png / Bottle (placed).png}} BottleBottleBottle
{{item|Goblin Tinkerer|image=[[File:Bound Goblin.png]] → [[File:Goblin Tinkerer.png]]}}
completely custom image code, at least one [[File: must be present
Bound Goblin.pngGoblin Tinkerer.pngGoblin Tinkerer
{{item|Soul of Night|image=Soul of Night.gif}} Soul of NightSoul of Night
{{item|Soul of Night|ext=gif}} Soul of NightSoul of Night
{{item|Soul of Night|image=Soul of Night.gif / Soul of Light.gif}} Soul of NightSoul of NightSoul of Night
{{item|Treasure Bag|s|ext=gif}} Treasure BagTreasure Bags(Desktop, Console and Mobile versions)

Size and scale

Resizing images.

Code Result
{{item|Beach Ball}}
original size: 50×50 pixels
Beach BallBeach Ball
{{item|Beach Ball|size=25px}}
effective size: 25×25 pixels
Beach BallBeach Ball
{{item|Beach Ball|size=25x100px}}
effective size: 25×25 pixels
Beach BallBeach Ball
{{item|Beach Ball|size=30px*0.5}}
effective size: 15×15 pixels
Beach BallBeach Ball
{{item|Beach Ball|scale=0.5}}
effective size: 25×25 pixels
Beach BallBeach Ball
{{item|Beach Ball|size=100px*0.2|scale=3}}
effective size: 60×60 pixels
Beach BallBeach Ball
{{item|Beach Ball|maxsize=25px}}
effective size: 25×25 pixels
Beach BallBeach Ball
{{item|Beach Ball|maxsize=100px}}
effective size: 50×50 pixels
Beach BallBeach Ball
{{item|Clown}}
original size: 58×98 pixels
ClownClown
{{item|Clown|size=x40px}}
effective size: 23×40 pixels
ClownClown
{{item|Clown|scale=0.5}}
effective size: 29×49 pixels
ClownClown
{{item|Clown|size=x120px}}
effective size: 58×98 pixels
(attempting to enlarge with this syntax has no effect; the following must be used instead)
ClownClown
{{item|Clown|size=71x120px}}
or
{{item|Clown|size=71px}}
effective size: 71×120 pixels
ClownClown

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
FurnaceFurnaceFurnace
{{item|Furnace|image=Furnace.png / Furnace (placed).gif|size=20px}}
effective sizes: 20×17 pixels, 20×15 pixels
FurnaceFurnaceFurnace
{{item|Furnace|image=Furnace.png / Furnace (placed).gif|size=20px / 30px}}
effective sizes: 20×17 pixels, 30×22 pixels
FurnaceFurnaceFurnace
{{item|Furnace|image=Furnace.png / Furnace (placed).gif|size=20px / 30px / 40px}}
effective sizes: 20×17 pixels, 30×22 pixels
FurnaceFurnaceFurnace
{{item|Furnace|image=Furnace.png / Furnace (placed).gif / Furnace.png|size=20px / 30px}}
effective sizes: 20×17 pixels, 30×22 pixels, 30×26 pixels
FurnaceFurnaceFurnaceFurnace

Platform icons

Controlling the appearance of platform icons, custom icons.

Code Result
{{item|Zenith}} ZenithZenith(Desktop, Console and Mobile versions)
{{item|Zenith|small=y}} ZenithZenith(Desktop, Console and Mobile versions)
{{item|Zenith|wrap=y}} ZenithZenith(Desktop, Console and Mobile versions)
{{item|Zenith|icons=n}} ZenithZenith
{{item|Zenith|icons={{eicons|Ocram}}}} ZenithZenith(Old-gen console and 3DS versions)

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
ZenithZenith(Old-gen console and 3DS versions)
{{item|Zenith|small=y|icons={{eicons|Ocram}}}}
icons are small
ZenithZenith(Old-gen console and 3DS versions)

Note text

Various forms of supplementary text.

Code Result
{{item|Healing Potion}} Healing PotionHealing Potion
{{item|Healing Potion|note=(rare)}} Healing PotionHealing Potion(rare)
{{item|Healing Potion|note=restores health}} Healing PotionHealing Potionrestores health
{{item|Healing Potion|note=restores health|wrap=y}} Healing PotionHealing Potionrestores health
{{item|Healing Potion|note2=restores health}} Healing PotionHealing Potionrestores health
{{item|Healing Potion|bignote=restores health}} Healing PotionHealing Potionrestores health
{{item|Healing Potion|bignote={{footnote|If [[Greater Healing Potion]]s are unavailable.}}}} Healing PotionHealing Potion[a]

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.}}}} Healing PotionHealing Potion(rare)restores health[b]

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}} Healing PotionHealing Potion(rare)
{{item|Healing Potion|note=(rare)|wrap=y|note2=restores health}} Healing PotionHealing Potion(rare)restores health

ID

Displaying data IDs, different types of IDs, displaying entities by their IDs.

Code Result
{{item|Silver Coin}} Silver CoinSilver Coin
{{item|Silver Coin|showid=y}} Silver CoinSilver CoinInternal Item ID: 72
{{item|id=72}}
displaying an item by its ID
Silver CoinSilver CoinInternal Item ID: 72
{{item|id=72|showid=n}}
the ID is displayed by default when $id is used and must be disabled explicitly if desired
Silver CoinSilver Coin
{{item|id=72|showid=n|t=Item 72}} Silver CoinItem 72
{{item|Coins|image=Silver Coin.png|id=71–74}} CoinsCoinsInternal Item ID: 71–74

For entities that are not items, $type must be specified.

Code Result
{{item|Venom Bullet|showid=y}} Venom BulletVenom BulletInternal Item ID: 1342
{{item|Venom Bullet|id=283|type=projectile}} Venom BulletVenom BulletInternal Projectile ID: 283
{{item|Venom Bullet|id=283|type=projectile|image=Venom Bullet (projectile).png}} Venom BulletVenom BulletInternal Projectile ID: 283
{{item|Goblin Scout|showid=y}} Goblin ScoutGoblin ScoutInternal Item ID:
{{item|Goblin Scout|showid=y|type=npc}} Goblin ScoutGoblin ScoutInternal NPC ID: 73
{{item|type=npc|id=73}} Goblin ScoutGoblin ScoutInternal NPC ID: 73
{{item|Molten Breastplate|id=9|type=armor}} Molten BreastplateMolten BreastplateInternal Armor ID: 9

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
Lava LampLava Lamp(Desktop, Console and Mobile versions)
{{item|Lava Lamp|wrap=y|note=(furniture)}}
icons and note: note will wrap to the next line
Lava LampLava Lamp(Desktop, Console and Mobile versions)(furniture)
{{item|Lava Lamp|wrap=y|note=(furniture)|icons=n}}
note and no icons: note will wrap to the next line
Lava LampLava Lamp(furniture)
{{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
Lava LampLava Lamp(furniture)(Desktop, Console and Mobile versions)Internal Item ID: 3253
{{item|Lava Lamp|wrap=y|note=(furniture)|note2=from Party Girl}}
same for $note2
Lava LampLava Lamp(furniture)(Desktop, Console and Mobile versions)from Party Girl
{{item|Lava Lamp|wrap=y|note=(furniture)|note2=from Party Girl|showid=y}}
ID and $note2 will each always occupy their own line
Lava LampLava Lamp(furniture)(Desktop, Console and Mobile versions)from Party GirlInternal Item ID: 3253

Anchor

Creating the anchor, linking to it.

Code Result
{{item|Wood Wall|image=Wood Wall (placed).png|anchor=y}} Wood WallWood Wall
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)}} Dart RifleDart Rifle(requires darts)(Desktop, Console and Mobile versions)Internal Item ID: 3008
{{item|Dart Rifle|mode=image|showid=y|note=(requires darts)}} Dart Rifle
{{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}}
|}
Image Name
Dart Rifle Dart Rifle(requires darts)(Desktop, Console and Mobile versions)Internal Item ID: 3008
Poison Dart Poison Darts
{| 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
|}
Image Name Notes
Dart Rifle Dart Rifle(requires darts)(Desktop, Console and Mobile versions)Internal Item ID: 3008 Weapon
Poison Dart Poison Darts Ammunition
Requires weapon

Custom styling

Styling with CSS.

Code Result
{{item|Princess|showid=y|type=npc|note=with Resonance Scepter|note2=(town NPC)}} PrincessPrincesswith Resonance Scepter(Desktop, Console and Mobile versions)(town NPC)Internal NPC ID: 663
{{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;}} PrincessPrincesswith Resonance Scepter(Desktop, Console and Mobile versions)(town NPC)Internal NPC ID: 663
{{item|Princess|showid=y|type=npc|note=with Resonance Scepter|note2=(town NPC)|css=color: var(--theme-text-color-green);}} PrincessPrincesswith Resonance Scepter(Desktop, Console and Mobile versions)(town NPC)Internal NPC ID: 663

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)}} PrincessPrincesswith Resonance Scepter(Desktop, Console and Mobile versions)(town NPC)Internal NPC ID: 663
{{item|Princess|class=boldname|nolink=y}} PrincessPrincess(Desktop, Console and Mobile versions)
{{item|Princess|class=boldname|nolink=y|css=color: var(--theme-text-color-note);}} PrincessPrincess(Desktop, Console and Mobile versions)

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}} PrincessPrincesswith Resonance Scepter(Desktop, Console and Mobile versions)(town NPC)Internal NPC ID: 663
{{item|Princess|showid=y|type=npc|note=with Resonance Scepter|note2=(town NPC)|class=notecolor|css=color: var(--theme-text-color-green);}} PrincessPrincesswith Resonance Scepter(Desktop, Console and Mobile versions)(town NPC)Internal NPC ID: 663

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
PrincessPrincesswith Resonance Scepter(Desktop, Console and Mobile versions)(town NPC)Internal NPC ID: 663
{{item|Princess|showid=y|type=npc|note=with Resonance Scepter|note2=(town NPC)|class=note2size}}
both small
PrincessPrincesswith Resonance Scepter(Desktop, Console and Mobile versions)(town NPC)Internal NPC ID: 663
{{item|Princess|showid=y|type=npc|note=with Resonance Scepter|note2=(town NPC)|class=notesize note2size}}
inversion of the default
PrincessPrincesswith Resonance Scepter(Desktop, Console and Mobile versions)(town NPC)Internal NPC ID: 663

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
Image Name
Princess Princesswith Resonance Scepter(Desktop, Console and Mobile versions)(town NPC)Internal NPC ID: 663
{| 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}}
|}
Image Name
Princess Princesswith Resonance Scepter(Desktop, Console and Mobile versions)(town NPC)Internal NPC ID: 663
Princess Princesswith Resonance Scepter(Desktop, Console and Mobile versions)(town NPC)Internal NPC ID: 663
Princess Princesswith Resonance Scepter(Desktop, Console and Mobile versions)(town NPC)Internal NPC ID: 663

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}} PrincessPrincesswith Resonance Scepter(Desktop, Console and Mobile versions)(town NPC)Internal NPC ID: 663
{{item|Princess|showid=y|type=npc|note=with Resonance Scepter|note2=(town NPC)|class=textcenter}} PrincessPrincesswith Resonance Scepter(Desktop, Console and Mobile versions)(town NPC)Internal NPC ID: 663
{{item|Princess|showid=y|type=npc|note=with Resonance Scepter|note2=(town NPC)|class=textright}} PrincessPrincesswith Resonance Scepter(Desktop, Console and Mobile versions)(town NPC)Internal NPC ID: 663

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 GelGel is inline and the item WoodWood is not.

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)}} PrincessPrincesswith Resonance Scepter(Desktop, Console and Mobile versions)(town NPC)Internal NPC ID: 663
{{item|Princess|class=allblock aligncenter}} PrincessPrincess(Desktop, Console and Mobile versions)

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
Wall of FleshWall of Flesh
{{item|Wall of Flesh|size=x64px|Wall of<br/>Flesh}}
entity name over multiple lines: not vertically centered by default
Wall of FleshWall of
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
Wall of FleshWall of
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}} DryadDryad
{{item|Dryad|class=mirror}} DryadDryad
{{item|Dryad|class=flip}} DryadDryad
{{item|Dryad|class=rotate90}} DryadDryad
{{item|Dryad|class=rotate180}} DryadDryad
{{item|Dryad|class=rotate270}} DryadDryad
{{item|Dryad|class=mirror|image=Dryad.png / Dryad.png / Dryad.png}}
only the first image is affected
DryadDryadDryadDryad
{{item|Dryad|image={{transform|[[File:Dryad.png]]|mirror=y}}[[File:Dryad (Shimmered).png]]{{transform|[[File:Dryad.png]]|mirror=y}}[[File:Dryad (Shimmered).png]]}}
Dryad.png
Dryad (Shimmered).png
Dryad.png
Dryad (Shimmered).png
Dryad

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.

NameAliasInitial ValueValue Mapping[1]Note
smallsmallicons
(empty)yesy
ony
n(empty)
no(empty)
off(empty)
icons(empty)y(empty)
yes(empty)
on(empty)
non
offn
anchor(empty)yesy
ony
n(empty)
no(empty)
off(empty)
mode(empty)
typeitem
wrap(empty)yesy
ony
n(empty)
no(empty)
off(empty)
nolink(empty)yesy
ony
n(empty)
no(empty)
off(empty)
class(empty)
cssstyle
(empty)
scale(empty)
maxsize(empty)
showid(empty)yesy
ony
non
offn
No default value, will be automatically detected by other parameters.
  1. 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}}
  • Coin RingCoin Ring(Desktop, Console and Mobile versions)
  • Gold RingGold Ring(Desktop, Console and Mobile versions)
  • Greedy RingGreedy Ring(Desktop, Console and Mobile versions)
{{options/set|item|nolink=y}}
* {{item|Coin Ring}}
* {{item|Gold Ring}}
* {{item|Greedy Ring}}
{{options/reset|item}}
  • Coin RingCoin Ring(Desktop, Console and Mobile versions)
  • Gold RingGold Ring(Desktop, Console and Mobile versions)
  • Greedy RingGreedy Ring(Desktop, Console and Mobile versions)
{{options/set|item|small=y}}
* {{item|Coin Ring}}
* {{item|Gold Ring}}
* {{item|Greedy Ring}}
{{options/reset|item}}
  • Coin RingCoin Ring(Desktop, Console and Mobile versions)
  • Gold RingGold Ring(Desktop, Console and Mobile versions)
  • Greedy RingGreedy Ring(Desktop, Console and Mobile versions)
{{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
  • Coin Ring
  • Gold Ring
  • Greedy Ring
  • Coin Ring(Desktop, Console and Mobile versions)
  • Gold RingGold Ring(Desktop, Console and Mobile versions)
  • Greedy Ring(Desktop, Console and Mobile versions)
{{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
  • Coin RingCoin Ring(Desktop, Console and Mobile versions)
  • Gold RingGold Ring(Desktop, Console and Mobile versions)
  • Greedy RingGreedy Ring(Desktop, Console and Mobile versions)
{{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}}
  • Coin RingCoin Ring(Desktop, Console and Mobile versions)
  • Gold RingGold Ring(Desktop, Console and Mobile versions)
  • Greedy RingGreedy Ring(Desktop, Console and Mobile versions)

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}} Lucky CoinLucky Coin {{item|Lucky Coin}} Moneta fortunataMoneta fortunata

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}} Coin RingCoin Ring(Desktop, Console and Mobile versions) {{item|Coin Ring}} Anello di moneteAnello di monete(Desktop, Console and Mobile versions)
{{item|Coin Ring|Ring}} Coin RingRing(Desktop, Console and Mobile versions) {{item|Coin Ring|Anello}} Anello di moneteAnello(Desktop, Console and Mobile versions)

Notice how only the second unnamed parameter is translated to Italian (RingAnello), not the first unnamed parameter (Coin Ring). Translating both would be incorrect:

English page Italian page
Code Result Code Result
{{item|Coin Ring|Ring}} Coin RingRing(Desktop, Console and Mobile versions) {{item|Anello di monete|Anello}} Anello di moneteAnello

The image and platform icons are broken, and the link is incorrect.

Footnotes

  1. If Greater Healing Potions are unavailable.
  2. If Greater Healing Potions are unavailable.