Difference between revisions of "Collapsible"

(updated default width)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>{</includeonly><includeonly>{{!}} style="background-color:#1d1d1d; width: {{{width|}}}%;"  
+
<includeonly>{</includeonly><includeonly>{{!}} style="background-color:#1d1d1d; width: {{#if: {{{width|}}}|{{{width}}}|85}}%;"  
 
{{!}}
 
{{!}}
==={{{header|}}}===
+
<div class="mw-collapsible mw-{{#ifeq:{{{collapsed|}}}|false|expanded|collapsed}}>
 +
{{#if: {{{header|}}}|==={{{header|}}}===}}
 
{{{1|}}}
 
{{{1|}}}
<div class="mw-collapsible mw-{{#ifeq:{{{collapsed|}}}|false|expanded|collapsed}}>
+
<div class="mw-collapsible-content">
 
{{{2|}}}
 
{{{2|}}}
 
</div>
 
</div>
Line 9: Line 10:
 
<noinclude>
 
<noinclude>
 
Creates a box with a collapsible segment.
 
Creates a box with a collapsible segment.
;|width
+
<pre>
Sets the box width to a percentage of the site width.
+
{{Collapsible
;|header
+
|width=85
Creates a level 3 header within the box, but outside the collapsible segment.  
+
|header=<header title>
;|collapsed
+
|collapsed=true
 +
|<text outside collapsible area>
 +
|<text within collapsible area>
 +
}}</pre>
 +
 
 +
== Parameters ==
 +
;width
 +
Sets the box width to a percentage of the site width. Defaults to 85%.
 +
;header
 +
When set, creates a level 3 header within the box, but outside the collapsible segment.  
 +
;collapsed
 
Starts in the expanded state when set to '''false'''. Defaults to the collapsed state when not set or set to any other value, including '''true'''.
 
Starts in the expanded state when set to '''false'''. Defaults to the collapsed state when not set or set to any other value, including '''true'''.
;|1
+
;unnamed parameter 1
 
Holds text outside the collapsible segment, this text will be visible in both expanded and collapsed states
 
Holds text outside the collapsible segment, this text will be visible in both expanded and collapsed states
;|2
+
;unnamed parameter 2
 
holds the text within the collapsible segment. This text will be hidden when the segment is collapsed. Headers in this segment will not work from the Table of Contents when the section is collapsed.
 
holds the text within the collapsible segment. This text will be hidden when the segment is collapsed. Headers in this segment will not work from the Table of Contents when the section is collapsed.
 +
</noinclude>

Latest revision as of 16:58, 27 February 2022


Creates a box with a collapsible segment.

{{Collapsible
|width=85
|header=<header title>
|collapsed=true
|<text outside collapsible area>
|<text within collapsible area>
}}

Parameters

width

Sets the box width to a percentage of the site width. Defaults to 85%.

header

When set, creates a level 3 header within the box, but outside the collapsible segment.

collapsed

Starts in the expanded state when set to false. Defaults to the collapsed state when not set or set to any other value, including true.

unnamed parameter 1

Holds text outside the collapsible segment, this text will be visible in both expanded and collapsed states

unnamed parameter 2

holds the text within the collapsible segment. This text will be hidden when the segment is collapsed. Headers in this segment will not work from the Table of Contents when the section is collapsed.

Get MetaBattle Premium
Enjoy an ad-free experience & support the website, for less than $1 per month! Upgrade to Premium