Test

This page contains documentation and demos for the tabs extension. Paste this text on a wiki article with the tabs extension installed to view these demos. -	= Installation = = Configuration = This extension has no configuration options in, but it does have the MediaWiki:tabs-dropdown-bgcolor message associated with it, which is not meant to be translated. This message contains the default value for the  style for dropdown menus. This needs to be a valid  value. It also has the following internationalisation messages associated with it: *MediaWiki:tabs-tab-label - The default label for a tab. The  stands for the index of the tab. *MediaWiki:tabs-toggle-open - The default opening label for toggle boxes. *MediaWiki:tabs-toggle-close - The default closing label for toggle boxes. *MediaWiki:tabs-dropdown-label - The default label for a dropdown menu. = Usage = == General usage information == Note: - This extension uses the  attribute for dropdown menus. This is in no way meant as encouragement for the use of this deprecated attribute anywhere other than this tag. For both the  and   tags, parser functions can be used within the content of the tag, but not in the attributes. To use parser functions within the attributes, the  or   parser functions should be used. The  parser function will also work, but since the only attributes it can define are the   and   attributes, these don't allow complete support. For example, this will not work:  Foo Bar But this will work: === Hotlinking tabs === It is possible to hotlink tabs the same way as hotlinking sections on pages. Simply put the tab label in the URL, and the page will automatically scroll to the top of the tab, and open the selected tab. This will always open only the very first tab that has the specified tab label (for example, if there are two tab boxes that both have a tab labelled "Tab 1", putting  in the URL will scroll to the first one on the page). If there is already another element on the page that could be scrolled to, such as a page section, that other element will have priority, and the tab will not be focused. == Toggle box == === Documentation === You can create a simple collapsible box by enclosing some content between. All content within the tags will be displayed within the toggle box. ==== Available attributes: ==== * - If this attribute is set, the toggle box will appear collapsed when the page loads. Otherwise it will be opened. * - If this attribute is set, the toggle box can be placed within text without interrupting the flow of the text. * - See. *Name attributes: ** - The label for the toggle box that indicates that clicking it will close the box. Default value is stored in the MediaWiki:tabs-toggle-open page. ** - Same as , but for closing the toggle box. Default is stored in MediaWiki:tabs-toggle-close. ** - If neither the   and   is defined, this value will be used for both states. **If only one of the  or   attributes is defined, the other will take its value. If neither is defined, and the  attribute is also not defined, the default values are taken from the respective MediaWiki pages. * - Use this attribute to define any styles for the toggle box container. Styles defined here will only affect the content of the toggle box, not the label. *Default HTML attributes: ** - Determines the tooltip shown when hovering over the box. ** - Use this attribute to define any styles for the box. This can also affect the box's label. ** - Adds classes to the box. ** - Adds an id to the box. This id must be unique on the page, as with any id. === Toggle box demos === ==== Plain toggle box ====  &lt;tab&gt;This toggle box has no attributes assigned to it.&lt;/tab&gt; This toggle box has no attributes assigned to it. ==== Toggle box attributes ====  &lt;tab collapsed openname="Toggle" style="font-weight:bold;width:500px;" container="font-style:italic;" title="Example tooltip"&gt; This toggle box has the following attributes defined: * - By default, it is closed. * - The label will show "Toggle" when it can be clicked to open the box. Since no  attribute is defined, it defaults to "Toggle" too. * - The whole toggle box will be bold, and have a width of 500px. * - Only the contents of the toggle box will be italic. * - The tooltip that shows when hovering over this tab is defined via the   attribute. &lt;/tab&gt;  This toggle box has the following attributes defined: * - By default, it is closed. * - The label will show "Toggle" when it can be clicked to open the box. Since no  attribute is defined, it defaults to "Toggle" too. * - The whole toggle box will be bold, and have a width of 500px. * - Only the contents of the toggle box will be italic. * - The tooltip that shows when hovering over this tab is defined via the   attribute. ==== Inline toggle boxes ====  &lt;tab inline collapsed openname="Show" closename="Hide"&gt; Here is an example of an inline toggle box. This togglebox is  and  This toggle box has the attributes   and   to change the default label text. == Dropdown menus == === Documentation === Dropdown menus are made by simply defining the  attribute on a toggle box. They can be opened by either hovering over the label, or by clicking on the label to keep it opened even after moving away the cursor. Dropdown menus have an opening delay of 0.2 seconds built in to prevent accidental opening when hovering over the label, and to prevent accidental closing when accidentally moving the cursor off the dropdown. This delay is enough to prevent accidents like those, but is not enough to be bothersome. Dropdown menus are heavily based on the code for toggle boxes, so will also resemble them in many ways. There are a couple of quite distinct differences though. Since dropdown menus use the  tag for their content, it is permitted to use   tags directly within the dropdown menu's contents. Any other content is also allowed. Dropdown menus will convert all list items and links placed within to specially styled list items. The only exception is that links only show as they normally do when placed within unordered lists (any line starting with). In ordered lists, or outside list items, they take up the full list item. This is also the only difference between ordered and unordered lists. Any nested lists will be rendered as sub-menus in the dropdown menu. Nested lists are created by starting a line with multiple  or   characters. There is one limitation with this however: Individual nested lists can not alternate between ordered and unordered lists. Seperate levels can, however. For example, this is not allowed: *Menu item 1 *Menu item 2 **Sub-menu item 1 *#Sub-menu item 2 But this is: *Menu item 1 #Menu item 2 #*Sub-menu item 1 #*Sub-menu item 2 #*#Sub-sub-menu item 1 ==== Available attributes: ==== *All attributes that are available for toggle boxes * - Must be defined for the toggle box to become a dropdown menu. * and   - These attributes are identical to the   attribute in dropdown menus. It is not possible to let the dropdown switch between 2 values. If the  attribute is set, that value will be used as label, otherwise the   value is used, and if neither of those values is set, the   value is used. * - Because of how the background-color styling for dropdown works (background styles are applied to all items within dropdowns, otherwise they would become transparent), background colors need to be defined seperately. This must be done in the  attribute. This attribute works exactly the same as the  style in CSS. This defaults to the value defined in MediaWiki:tabs-dropdown-bgcolor. === Dropdown demos === ==== Dropdown without lists ====  &lt;tab dropdown style="width:300pt" openname="Click/hover to show" closename="Showing..."&gt; This dropdown contains no lists, so it will not have any of the styling designed for dropdowns. It does work as it normally would though. This dropdown also has its  attribute set to. It also has different  and   attributes, so it defaults to the   value. &lt;/tab&gt;  This dropdown contains no lists, so it will not have any of the styling designed for dropdowns. It does work as it normally would though. This dropdown also has its  attribute set to. It also has different  and   attributes, so it defaults to the   value. ==== Background-color for dropdowns ====  &lt;tab dropdown bgcolor="salmon}body{font-weight:bold;"&gt; This tab has a its  attribute set to. Just defining a  style would not work. &lt;/tab&gt; <tab dropdown bgcolor="salmon}body{font-weight:bold;"> This tab has a its  attribute set to. Just defining a  style would not work. ==== Lists and links ==== Here you can see the difference between unordered and ordered lists within dropdowns. The appearance of both does not change, but the behaviour of links within them does. <tab openname="Show code" closename="Hide code" collapsed block style="max-width:100%;"><pre style="overflow:auto;"> &lt;tab dropdown&gt; #The first 2 items use ordered lists, which will show links as list items too. #Example link *From here on this dropdown uses ordered lists, so links are shown within text. *See this example link. *Any links in dropdown menus placed outside lists will also be rendered as list items, like the following link: Example link &lt;/tab&gt; #The first 2 items use ordered lists, which will show links as list items too. #Example link *From here on this dropdown uses ordered lists, so links are shown within text. *See this example link. *Any links in dropdown menus placed outside lists will also be rendered as list items, like the following link: Example link ==== Inline dropdowns ==== <tab openname="Show code" closename="Hide code" collapsed block style="max-width:100%;"><pre style="overflow:auto;"> &lt;tab dropdown inline&gt; *You can do anything you'd normally do in a dropdown *This box will fit in with the text. &lt;/tab&gt; It is also possible to create inline dropdowns: *You can do anything you'd normally do in a dropdown *This box will fit in with the text. . This will also not interrupt the flow of the text. ==== Nested lists ==== <tab openname="Show code" closename="Hide code" collapsed block style="max-width:100%;"><pre style="overflow:auto;"> &lt;tab dropdown&gt; *This dropdown menu demonstrates dropdown menus with multiple levels. *Hovering over a list item with further lists nested within it will cause the next level to show up	*Hover over this item to see **This list now shows up. **Nested lists can also contain even more lists **See this item for example ***This is a third level menu **This can go on for any amount of levels. *Multiple sub-menus are also allowed **Such as this one. &lt;/tab&gt; *This dropdown menu demonstrates dropdown menus with multiple levels. *Hovering over a list item with further lists nested within it will cause the next level to show up	*Hover over this item to see **This list now shows up. **Nested lists can also contain even more lists **See this item for example ***This is a third level menu **This can go on for any amount of levels. *Multiple sub-menus are also allowed **Such as this one. ==== Alternating ordered and unordered lists ==== <tab openname="Show code" closename="Hide code" collapsed block style="max-width:100%;"><pre style="overflow:auto;"> &lt;tab dropdown&gt; *It is possible to alternate between ordered and unordered lists, but not within sub-menus. *The first 2 items are unordered list items #And this is an ordered list item #*This is an unordered list item again #*This also has to be an unordered list item #*#This can be an ordered list item again though #*#But then this also has to be ordered. #*Within an individual sub-menu, it is not possible to change between ordered and unordered list items &lt;/tab&gt; *It is possible to alternate between ordered and unordered lists, but not within sub-menus. *The first 2 items are unordered list items #And this is an ordered list item #*This is an unordered list item again #*This also has to be an unordered list item #*#This can be an ordered list item again though #*#But then this also has to be ordered. #*Within an individual sub-menu, it is not possible to change between ordered and unordered list items <tab openname="Show code" closename="Hide code" collapsed block style="max-width:100%;"><pre style="overflow:auto;"> &lt;tab dropdown&gt; *This item is in an unordered list, so it allows in-line linking. #This item and the next one are in an ordered list, so they turn links into list-items #List-item links #*...with a sub-menu that uses unordered lists again, so allows in-line linking again. #*#And this sub-menu again creates... #*#...list-item links &lt;/tab&gt; *This item is in an unordered list, so it allows in-line linking. #This item and the next one are in an ordered list, so they turn links into list-items #List-item links #*...with a sub-menu that uses unordered lists again, so allows in-line linking again. #*#And this sub-menu again creates... #*#...list-item links == Tab menus == === Documentation === Tab menus can be used to make it possible to switch between different layouts. Anything within  tags is rendered as a tab menu. Individual tabs are then defined via a  tag. ==== Available attributes ==== ; 	* - Use this attribute to define any styles for the tabs container. Styles defined here will only affect the container of the tabs, not the labels. * - If this attribute is set, the tab interface will be a much more plain layout, without a border around the container, and with the tab labels just being buttons above it, instead of the typical tab layout. This can be used to get more freedom in styling the interface. ; 	* - If this attribute is set, the tab's contents can be placed within text without interrupting the flow of the text. The difference between this and the default state of  is that with , the tab's contents are forced to a new line when placed at the end of a new line, when not the whole of the tab's contents fit on the same line. tabs however will use up any space that's left at the end of the line, and fit in with the normal flow of the text just like normal text. * - Converts the tab's contents to a block element. This can be used to assure the tab's contents will be displayed as a block instead of an inline-block, in cases where the tab's contents should not be placed within a line of text. When both the  and   attributes are available, the   attribute will be ignored. *Name attributes: ** - This will determine the index of the tab. This only works if the entered index is already the index of a defined tab. Otherwise, this attribute is ignored. If no valid index or matching name attributes are defined, the index is automatically set to be the next in the list of tabs. ** - This attribute is used to define the text the label shows for the tab. If the entered name already exists within the tab, the contents of the  tag are automatically assigned to the existing tab. This also means no two tabs can have an identical label. This attribute will be ignored if the  attribute already refers to an existing tab. Whitespace is automatically removed from the start and end of this attribute's value. ;Both *Default HTML attributes: ** - Determines the tooltip shown when hovering over the box. ** - Use this attribute to define any styles for the box. This can also affect the box's label. ** - Adds classes to the box. ** - Adds an id to the box. This id must be unique on the page, as with any id. ==== Self-closing tabs ==== Self-closing tabs can be used to define a list of tabs at the top of the tab menu, for later use via the  attribute. Self-closing tabs only have an effect when a name is defined, and no (valid) index is defined. The syntax for self-closing tabs is 	==== Parser function ==== As an alternative for the tab tag, the  parser function can also be used to simplify the syntax for tabs. The syntax for this parser function allows the following syntaxes: === Demos === ==== Naming and reusing tabs, and default text ==== <tab openname="Show code" closename="Hide code" collapsed block style="max-width:100%;"><pre style="overflow:auto;"> &lt;tabs&gt; &lt;tab name="First" style="border:1px solid black;"&gt;This tab has a defined. It also has a  attribute set to  .&lt;/tab&gt; &lt;tab name="Second" style="background:salmon;"&gt;This tab also has a defined  attribute, and its   attribute set to  .&lt;/tab&gt; &lt;tab&gt;This tab has no attributes defined. Its name is automatically generated based on its position.&lt;/tab&gt; &lt;tab index="1"&gt;This is a seperate tab. It has a defined  attribute with value "1". This makes it also show when the first tab is selected.&lt;/tab&gt; &lt;tab name="Second"&gt;This is a seperate tab. It has a defined  attribute, with a value equal to that of the second tab ("Second"). It therefore also shows when the second tab is opened.&lt;/tab&gt; This line of text will show for every tab you view. It is not placed within. It also has a  attribute set to. <tab name="Second" style="background:salmon;">This tab also has a defined  attribute, and its   attribute set to. This tab has no attributes defined. Its name is automatically generated based on its position. This is a seperate tab. It has a defined  attribute with value "1". This makes it also show when the first tab is selected. <tab name="Second">This is a seperate tab. It has a defined  attribute, with a value equal to that of the second tab ("Second"). It therefore also shows when the second tab is opened. This line of text will show for every tab you view. It is not placed within  and   tabs ==== <tab openname="Show code" closename="Hide code" collapsed block style="max-width:100%;"><pre style="overflow:auto;"> &lt;tabs&gt; &lt;tab name="Default 1" style="background:lightgreen;"&gt;First tab.&lt;/tab&gt; &lt;tab name="Default 2" style="background:lightgreen;"&gt;Second tab.&lt;/tab&gt; &lt;tab name="Inline" style="background:salmon;"&gt;Third tab.&lt;/tab&gt; &lt;tab name="Block" style="background:royalblue;"&gt;Fourth tab.&lt;/tab&gt; &lt;tab index="1"&gt;This is a seperate tab. It demonstrates what happens if a tab has no  or   attributes defined. If the tab contains a lot of text, it will automatically be forced to a new line, despite extra space being available at the end of the previous line.&lt;/tab&gt; &lt;tab index="2"&gt;This seperate tab isn't forced to a new line, since it's short enough.&lt;/tab&gt; &lt;tab index="3" inline&gt;This is a seperate tab that has an  attribute defined. It will fit in with the text as normal text would, and it fills up any space that is left available after the previous line. This makes tabs with  attributes a bit better at fitting in with the flow of text.&lt;/tab&gt; &lt;tab index="4" block&gt;Despite fitting on the previous line, the  attribute forces this seperate tab to a new line&lt;/tab&gt; &lt;/tabs&gt; <tab name="Default 1" style="background:lightgreen;">First tab. <tab name="Default 2" style="background:lightgreen;">Second tab. <tab name="Inline" style="background:salmon;">Third tab. <tab name="Block" style="background:royalblue;">Fourth tab. This is a seperate tab. It demonstrates what happens if a tab has no  or   attributes defined. If the tab contains a lot of text, it will automatically be forced to a new line, despite extra space being available at the end of the previous line. This seperate tab isn't forced to a new line, since it's short enough. This is a seperate tab that has an  attribute defined. It will fit in with the text as normal text would, and it fills up any space that is left available after the previous line. This makes tabs with  attributes a bit better at fitting in with the flow of text. Despite fitting on the previous line, the  attribute forces this seperate tab to a new line ====  tab interfaces ==== <tab openname="Show code" closename="Hide code" collapsed block style="max-width:100%;"><pre style="overflow:auto;"> &lt;tabs plain style="width:250px;"&gt; &lt;tab&gt;This tab interface doesn't have a box surrounding it, but just has buttons above it.&lt;/tab&gt; &lt;tab&gt;This makes it a bit easier to customise the box&lt;/tab&gt; &lt;tab&gt;It is also more useful for storing tabbed tables in&lt;/tab&gt; &lt;/tabs&gt; <tabs plain style="width:250px;"> This tab interface doesn't have a box surrounding it, but just has buttons above it. This makes it a bit easier to customise the box It is also more useful for storing tabbed tables in 	==== Inline switching parts ==== <tab openname="Show code" closename="Hide code" collapsed block style="max-width:100%;"><pre style="overflow:auto;"> &lt;tabs&gt; This line of text contains &lt;tab name="Exaggerating"&gt;over 9000&lt;/tab&gt;&lt;tab name="Truth"&gt;a couple of&lt;/tab&gt; switching parts. The &lt;tab index="1"&gt;biggest by far&lt;/tab&gt;&lt;tab index="2"&gt;main&lt;/tab&gt; part of this tab's contents is placed outside any &lt;tab index="1"&gt;awesome&lt;/tab&gt;  tags. The switching &lt;tab index="1"&gt;epicness&lt;/tab&gt;&lt;tab index="2"&gt;parts&lt;/tab&gt; are made by putting  tags within the flow of the text. &lt;/tabs&gt; This tab menu uses the regular syntax using the  tag. This line of text contains <tab name="Exaggerating">over 9000 <tab name="Truth">a couple of switching parts. The biggest by far main part of this tab's contents is placed outside any awesome   tags. The switching epicness parts are made by putting   tags within the flow of the text. This tab menu looks exactly the same, but uses the parser function  or. This makes the code a bit shorter. <tab openname="Show code" closename="Hide code" collapsed block style="max-width:100%;"><pre style="overflow:auto;"> &lt;tabs&gt; This line of text contains switching parts. The part of this tab's contents is placed outside any    tags. The switching are made by putting   tags within the flow of the text. &lt;/tabs&gt; This line of text contains switching parts. The part of this tab's contents is placed outside any    tags. The switching are made by putting   tags within the flow of the text. ==== Predefining tabs and reference syntax ==== Tabs can be predefined via either self-closing tabs or the parser function. This tab menu's third tab also uses the reference syntax for the parser function. <tab openname="Show code" closename="Hide code" collapsed block style="max-width:100%;"><pre style="overflow:auto;"> &lt;tabs&gt; &lt;tab name="First"/&gt; The tab is predefined via . &lt;tab index="3"&gt;The italic text in the above line is defined via a  reference. This automatically inserts the contents for the second value entered into the third tab too. &lt;/tab&gt; &lt;/tabs&gt; <tab name="First"/> The tab is predefined via . The italic text in the above line is defined via a  reference. This automatically inserts the contents for the second value entered into the third tab too. == Nested combinations == In some cases, it is possible to put multiple of these boxes inside each other. For this to work however, the,   or   parser functions will have to be used whenever two of the same tags are used anywhere within each other. This is required because otherwise the wikicode parser will recognise the closing tag for the nested tag as the closing tag for the outer tag, and skip the rest of the content, which could cause problems. For the  parser function, even boolean attributes (such as   or  ) need to have a value defined for them, otherwise they are not recognised as attributes. For example,  will not work (it will show a toggle box instead of a dropdown), while   will show a dropdown box. All combinations of nesting multiple tags will work, except for nesting any tab menus inside other tab menus. === Nested tab menus === ==== Inside toggle boxes ==== <tab openname="Show code" closename="Hide code" collapsed block style="max-width:100%;"><pre style="overflow:auto;"> &lt;tab&gt; This tab contains a tab menu: &lt;tabs&gt; &lt;/tabs&gt; &lt;/tab&gt; This tab contains a tab menu: ==== Inside dropdowns ==== <tab openname="Show code" closename="Hide code" collapsed block style="max-width:100%;"><pre style="overflow:auto;"> &lt;tab dropdown&gt; And here is another tab menu: &lt;tabs&gt; &lt;/tabs&gt; &lt;/tab&gt; And here is another tab menu: === Nested toggle/dropdown boxes === ==== Toggle boxes in toggle boxes ==== <tab openname="Show code" closename="Hide code" collapsed block style="max-width:100%;"><pre style="overflow:auto;"> &lt;tab&gt; This toggle box has another toggle box nested inside it. &lt;/tab&gt; This toggle box has another toggle box nested inside it. ==== Toggle boxes in dropdowns ==== <tab openname="Show code" closename="Hide code" collapsed block style="max-width:100%;"><pre style="overflow:auto;"> ==== Toggle boxes and dropdowns in tab boxes ==== If you want to place a toggle box or a dropdown inside a tab navigation, and want the toggle box to show up for every tab as opposed to just the tab it's nested in, first a parent  tab must be made, with , so that the toggle box won't be recognised as a seperate tab content. If you want to place a toggle box or dropdown menu inside a tab menu, you can simply place a  tag inside the   tag that functions as a tab. This will restrict toggle boxes and dropdowns to visibility in just one tab though. So, if you want to have a toggle box or dropdown that's visible in every tab, encase it in a  tag with an   set to it. That way, the outer  tag will be recognised as a tab container, and the inner one will be recognised as a toggle box or dropdown menu, as desired. The toggle box or dropdown must then also use the parser function syntax. If you want the contents of the toggle box inside the tab menu to be able to change depending on the selected tab, you should use the  attribute on the tag. This can be done by setting the very last argument of the  parser function or the   parser function to. See this demo for an example of how to make this work: <tab openname="Show code" closename="Hide code" collapsed block style="max-width:100%;"><pre style="overflow:auto;"> &lt;tabs&gt; &lt;tab name="Toggle box"&gt; This first tab has a toggle box nested inside it	&lt;/tab&gt; &lt;tab name="Dropdown"&gt; This second tab has a dropdown nested inside it	&lt;/tab&gt; &lt;tab index="*" block&gt; &lt;/tab&gt; &lt;/tabs&gt; <tab name="Toggle box"> This first tab has a toggle box nested inside it	<tab name="Dropdown"> This second tab has a dropdown nested inside it	<tab index="*" block> ==== Toggle boxes in dropdowns ==== <tab openname="Show code" closename="Hide code" collapsed block style="max-width:100%;"><pre style="overflow:auto;"> &lt;tab dropdown name="nested toggle boxes" style="width:250px"&gt; This dropdown has a nested toggle box that has  and   attributes filled in: &lt;/tab&gt; <tab dropdown name="nested toggle boxes" style="width:250px"> This dropdown has a nested toggle box that has  and   attributes filled in: ==== Dropdowns in dropdowns ==== <tab openname="Show code" closename="Hide code" collapsed block style="max-width:100%;"><pre style="overflow:auto;"> &lt;tab dropdown name="nested dropdowns"&gt; *It is even possible to have a dropdown inside a list item in another dropdown box *	*And it is even possible to have a dropdown inside sub-menus in the dropdown... **	Or if you want, you can place it outside lists too. &lt;/tab&gt; <tab dropdown name="nested dropdowns"> *It is even possible to have a dropdown inside a list item in another dropdown box *	*And it is even possible to have a dropdown inside sub-menus in the dropdown... **	Or if you want, you can place it outside lists too.