Template:Tabber

From Elwiki
Revision as of 17:48, 14 April 2022 by Ritsu (talk | contribs) (Undo revision 749432 by Ritsu (talk))
Information: If you want to test this template, please use Sandbox.
This documentation is transcluded from Template:Tabber/doc.
Information: If you are experiencing issues with post-expand template include limits or tables/other templates transcluded inside tab contents, consider using the Extension.

Overview

This is the refreshed version of Template:Tabs and what you should be using for making tabs now. This version is enhanced with Mobile Frontend support and is generally cleaned up. Also, the syntax has been updated.

Parameters

 Tip: All parameters get parsed as tab=content, unless they start with the $ sign. These parameters are optional.
  • $divclass - adds a custom class to the wrapper of the tabs. Available:
    • tabber-center that centers tabs horizontally,
    • tabber-vertical that swaps the layout to vertical mode,
    • tabber-border that adds a subtle border with padding around contents,
    • tabber-padding that increases the content padding,
    • fancy that changes the design to resemble the in-game one.
  • $divstyle - adds a style to the wrapper of the tabs
  • $tab[number]style - adds styles to the tab on the specified index
  • $con[number]style - adds styles to the content box on the specified index
  • $tabstyle - adds styles to tabs
  • $constyle - adds styles to content boxes
  • $conclass - adds classes to content boxes
  • $ulstyle - adds styles to tab list
  • $ulclass - adds classes to tab list

Example usage

{{Tabber
|Orange=Content of tab 1
|Banana=Content of tab 2
|Grape=Content of tab 3
|Pie=Content of tab 4
}}

Result:

  • Orange
  • Banana
  • Grape
  • Pie
  Tip: Nested tabs are also supported. Using tabber-border in $divclass recommended.
{{Tabber
|$divclass=tabber-border
|Tab 1=
{{Tabber
|Tab 1=Content of tab 1
|Tab 2=Content of tab 2
}}
|Tab 2=Content of tab 2
}}

Result:

  • Tab 1
  • Tab 2
  Warning: Templates do not work well with tables and other templates, but there is a workaround for that. Before providing the parameter's value that contains MediaWiki markup, use <dfn>{{</dfn> and insert <dfn>}}</dfn> at the end of the parameter's value. Using it is not required until you notice that something breaks.

Use like so:

{{Tabber
|$divclass=tabber-vertical
|Tab 1=<dfn>{{</dfn>
{| class="wikitable"
|'''Orange'''
|'''Apple'''
|-
|Bread
|Pie
|-
|Butter
|Ice cream 
|}
<dfn>}}</dfn>
|Tab 2=Content of tab 2
}}

Result:

  • Tab 1
  • Tab 2
  Tip: You can also style tabs with a similar design to the one that appears in-game when setting the $divclass parameter to fancy. You can combine it with other classes. Recommended: tabber-vertical.
{{Tabber
|$divclass=tabber-vertical fancy
|Latin=Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|Fruits=<dfn>{{</dfn>
{| class="wikitable"
|'''Orange'''
|'''Apple'''
|-
|Apple
|Grapes
|-
|Avocado
|Pineapples
|}
<dfn>}}</dfn>
}}

Result:

  • Latin
  • Fruits