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.

How To Create Collapsible Tables

 * 1) 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.


 * 1) Add some code to Customize the tables' appearance.
 * You can define this in your Mediawiki:Common.css code.
 * See here for some standard styling


 * 1) Now you need to customize your tables, by editing in source mode to make them collapsible.
 * 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 add
 * class="collapsible collapsed" to the opening of the table.

Sample Table
This code:

Creates this table: