Help:Infoboxes

Beta

Infoboxes are like fact sheets, or sidebars in magazine articles, designed to present a summary of the topic of the page. They present important points in an organized and quickly readable format. The sections of an infobox are usually the same among similar articles to create consistency across a community, and are made using templates.

How to use an infobox
You can add an infobox through source mode on an article by copying the syntax on the template's documentation page (found at the bottom of the infobox template's page) and pasting it at the top of an article, changing the words after the equals signs to provide the information needed. For example:

Creating new infoboxes


First, create new template with any name you like - Template:ExampleInfobox, for example. Next, we'll start with a basic infobox, with a title and an image.

This wikitext will tell your template to use name and image variables for title and image elements. Additionally you can provide the default tag, whose value will be used when a user does not specify a name/image/etc. on the article.

Now we just need two more fields containing additional information, so let's add one:

After adding one last field with source set to first and label to First seen, we end up with the following:

We can now use the template in an article and get a working infobox:

Styling and display
Infoboxes using this kind of code are automatically styled, using your community's theme. If any of the variables are empty, the relevant row of the template will not be displayed (unless the 'default' tag has been used).

Layout options
Two alternative layout options are available for infoboxes:

...  ...
 * default layout - &lt;data> tag labels displayed above the value
 * tabular layout - &lt;data> tag labels displayed on the left side of the value

Custom theming
Default infobox wikia color theme can be overwritten using either theme or theme-source attributes of infobox tag. The theme attribute is used for specifying default custom theme on the template level. The theme-source attribute holds variable name used to pass the custom theme name from template invocation inside the article. If both attributes are used inside the infobox tag the theme attribute is treated as default one.

 ...

The name of the custom theme is CSS class name added to the HTML wrapper for the infobox markup and can by styled in custom.css file.

.portable-infobox-theme-my-custom-theme { //custom theme styles }

Advanced usage
Now, that you have created a simple infobox, you can learn how to use more advanced fields. In this section we are going to build infobox shown on the right.

Multiple ordering options for simple tags
There are three normal key-value fields, then title and image fields. As you can see, the title field is not bound to be a first field, but you can only use the Title field once per infobox.

Grouping information inside the group tags
Next field will let you put a number of fields into group, each of which can be named with header. Remember: fields that are declared but don't have a value won't appear. This rule also applies to group - if none of the fields (excluding header tag) inside any particular group have a value, the whole thing won't show up.

Details



Alternative layout for group tags
Group tag can have alternative horizontal layout where all its content is displayed next to each other in single horizontal line. This can be achievied by adding layout='horizontal" attribute to the group tag.

...

Comparing values with comparison tag
And now the hardest of all, comparison tag. It gives you an easy way to compare two forces, especially useful in battle or war infoboxes.

Comparison contains set tags, each of which defines compared values. In header tag you can put name of the compared value. For inside use other fields introduced before, for example data tag.

Combatants Details Combatants

Now we just need to invoke it inside article, and the work is done.

Fields formatting
If you want to prepend or append some additional informations to your data, like add some icons, create categories or process the passed values, the fields formatting allows you to do that.

When tag format is specified for node, the variable provided in source= is formatted/modified like specified inside format tags. When variable provided in source= is empty, node renders values provided in default tags or doesn't render if default tags are not specified.

Some of the use cases:

added content $ links: [] categories:

Full syntax:

This effect:

Can be achieved with the following syntax: Price to buy

Available tags
All infobox fields should be declared using XML convention, with attributes used for field configuration.

Examples

 * Kratos ( source )
 * Beatrix Kiddo ( source )
 * Battle of Arrakeen ( source )