Difference between revisions of "Template:Collapsible"
Jump to navigation
Jump to search
(Test template.) |
|||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | {{#if: {{{collapsed|}}} | <div class="toccolours mw-collapsible mw-collapsed" style="width:auto; overflow:auto;"> | <div class="toccolours mw-collapsible" style="overflow:auto;"> }} | |
− | {{#if: {{{collapsed|}}} | <div class="toccolours mw-collapsible mw-collapsed" style="width: | ||
<div style="font-weight:bold;line-height:1.6;">{{#if: {{{title|}}} |{{{title}}} }}</div>{{ | <div style="font-weight:bold;line-height:1.6;">{{#if: {{{title|}}} |{{{title}}} }}</div>{{ | ||
#if: {{{alwaysshowncontent|}}} |{{{alwaysshowncontent}}} }} | #if: {{{alwaysshowncontent|}}} |{{{alwaysshowncontent}}} }} | ||
<div class="mw-collapsible-content">{{#if: {{{hiddencontent|}}} |{{{hiddencontent}}} }}</div> | <div class="mw-collapsible-content">{{#if: {{{hiddencontent|}}} |{{{hiddencontent}}} }}</div> | ||
</div> | </div> | ||
+ | |||
+ | <noinclude> | ||
+ | =Template Data= | ||
+ | <templatedata> | ||
+ | { | ||
+ | "description": "Template for adding 'spoiler' like content windows.", | ||
+ | "params": { | ||
+ | "collapsed": { | ||
+ | "label": "Collapsed", | ||
+ | "description": "If this should be collapsed by default on load.", | ||
+ | "type": "string", | ||
+ | "suggested": true | ||
+ | }, | ||
+ | "title": { | ||
+ | "label": "Title", | ||
+ | "description": "Bold, always shown on top of the template text.", | ||
+ | "type": "line" | ||
+ | }, | ||
+ | "alwaysshowncontent": { | ||
+ | "label": "Always Shown Content", | ||
+ | "description": "Content that is always shown in the box. This information can't be hidden.", | ||
+ | "type": "content" | ||
+ | }, | ||
+ | "hiddencontent": { | ||
+ | "label": "Hidden Content", | ||
+ | "description": "Content that can be hidden within the box.", | ||
+ | "type": "content", | ||
+ | "required": true | ||
+ | } | ||
+ | }, | ||
+ | "format": "block" | ||
+ | } | ||
+ | </templatedata> | ||
+ | =Examples= | ||
+ | |||
+ | <code><nowiki>{{Collapsible|collapsed=yes|alwaysshowncontent= You always see this! I can't be hidden!| hiddencontent= You only see this if you expanded me!}}</nowiki></code> | ||
+ | |||
+ | {{Collapsible|collapsed=yes|alwaysshowncontent= You always see this! I can't be hidden!| hiddencontent= You only see this if you expanded me!}} | ||
+ | |||
+ | <code><nowiki>{{Collapsible|title= This is a title!| hiddencontent= I'm always shown by default if collapsed is missing or empty!}}</nowiki></code> | ||
+ | |||
+ | {{Collapsible|title= This is a title!| hiddencontent= I'm always shown by default if collapsed is missing or empty!}} | ||
+ | |||
+ | <code><nowiki>{{Collapsible| hiddencontent= Sometimes you don't always want something so hide it all!}}</nowiki></code> | ||
+ | |||
+ | {{Collapsible| hiddencontent= Sometimes you don't always want something so hide it all!}} | ||
+ | </noinclude> |
Latest revision as of 04:12, 28 January 2020
Template Data
Template for adding 'spoiler' like content windows.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Collapsed | collapsed | If this should be collapsed by default on load. | String | suggested |
Title | title | Bold, always shown on top of the template text. | Line | optional |
Always Shown Content | alwaysshowncontent | Content that is always shown in the box. This information can't be hidden. | Content | optional |
Hidden Content | hiddencontent | Content that can be hidden within the box. | Content | required |
Examples
{{Collapsible|collapsed=yes|alwaysshowncontent= You always see this! I can't be hidden!| hiddencontent= You only see this if you expanded me!}}
You always see this! I can't be hidden!
You only see this if you expanded me!
{{Collapsible|title= This is a title!| hiddencontent= I'm always shown by default if collapsed is missing or empty!}}
This is a title!
I'm always shown by default if collapsed is missing or empty!
{{Collapsible| hiddencontent= Sometimes you don't always want something so hide it all!}}
Sometimes you don't always want something so hide it all!