Help:Tables/collapsible

Collapsible tables and templates allow you to add large elements to a page, without disrupting the flow of the text. For example, a large table which lists every character in a tv show, could be put on every character page. The table would be huge, but in collapsed state would not disrupt the page. Then it is easy for your readers to navigate through the other characters.

You will want to edit your table in source mode to apply these changes.

Check Special:Version on your wiki

 * If you have MW 1.19, the collapsible table javscript you need is available by default
 * If you have MW 1.16, then you need to import a script onto your wiki. Edit Mediawiki:Common.js and add the following line somewhere on the page.
 * importScriptPage('ShowHide/code.js', 'dev');
 * After you have published the page you will need to clear your browser cache.

Add some code to Customize the tables' appearance.

 * You can define this in your Mediawiki:Common.css code.
 * See here for some standard styling

Edit your tables

 * A collapsible table needs to have a header. Make sure you have a line which starts with an exclamation mark at the top of the table. eg.
 * ! I am a header that will display when the table is collapsed. 
 * If you want the default state of the table to be open then add class="collapsible" to the opening line of the table. So you might have:
 * {| style="margin:auto" class="collapsible" 
 * If you want the default state of the table to be closed then you would have
 * {| style="margin:auto" class="collapsible collapsed" 

Sample Table
This code:

Creates this table: