Template:Collapsible option: Difference between revisions

From Omniversalis
Content added Content deleted
m (unnecessary space)
 
m (1 revision imported)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{big|'''Initial visibility'''}}
'''How to manage this template's initial visibility'''<br />
To manage this template's visibility when it first appears, [[W:Help:Template#Parameters|add the parameter]]:
:{{para|state|collapsed}} to show the template in its collapsed state, i.e. hidden apart from its titlebar&nbsp;– e.g. <code><nowiki>{{</nowiki><includeonly>{{</includeonly>{{#if:{{{nobase|}}} | |BASE}}PAGENAME<includeonly>}}</includeonly><nowiki> |state=collapsed}}</nowiki></code>
:{{para|state|expanded}} to show the template in its expanded state, i.e. fully visible&nbsp;– e.g. <code><nowiki>{{</nowiki><includeonly>{{</includeonly>{{#if:{{{nobase|}}} | |BASE}}PAGENAME<includeonly>}}</includeonly><nowiki> |state=expanded}}</nowiki></code>
:{{para|state|autocollapse}} to show the template in its collapsed state ''but only if'' there is another template of the same type on the page&nbsp;– e.g. <code><nowiki>{{</nowiki><includeonly>{{</includeonly>{{#if:{{{nobase|}}} | |BASE}}PAGENAME<includeonly>}}</includeonly><nowiki> |state=autocollapse}}</nowiki></code>


Unless set otherwise (see the {{para|state}} parameter in the template's code), the template's default state is <code>{{#switch:{{{default|}}}|collapsed=collapsed|expanded=expanded|autocollapse|#default=autocollapse}}</code>.<!--
To set the template's initial visibility, the {{para|state}} [[Help:Template#Parameters|parameter]] may be used:
<ul>
<li>{{para|state|collapsed}}: <nowiki>{{</nowiki><includeonly>{{</includeonly>{{#if:{{{nobase|}}}| |BASE}}PAGENAME<includeonly>}}</includeonly><nowiki>|state=collapsed}}</nowiki> to show the template collapsed, i.e., hidden apart from its title bar
<li>{{para|state|expanded}}: <nowiki>{{</nowiki><includeonly>{{</includeonly>{{#if:{{{nobase|}}} | |BASE}}PAGENAME<includeonly>}}</includeonly><nowiki>|state=expanded}}</nowiki> to show the template expanded, i.e., fully visible
<li>{{para|state|autocollapse}}: <nowiki>{{</nowiki><includeonly>{{</includeonly>{{#if:{{{nobase|}}} | |BASE}}PAGENAME<includeonly>}}</includeonly><nowiki>|state=autocollapse}}</nowiki><ul>
<li>shows the template collapsed to the title bar if there is a <nowiki>{{navbar}}, a {{sidebar}}</nowiki>, or some other table on the page with the collapsible attribute
<li>shows the template in its expanded state if there are no other collapsible items on the page
</ul></ul>
If the {{para|state}} parameter is not set, the template's initial visibility is taken from the {{para|default}} parameter in the template. For this template, that currently evaluates to <code>{{#switch:{{{default|}}}|collapsed=collapsed|expanded=expanded|autocollapse|#default=autocollapse}}</code>.</ul><!--
-->{{#if:{{{align|}}}|
-->{{#if:{{{align|}}}|
:{{para|align|''value''}} is also available; where ''value'' can be either <code>right</code> or <code>left</code>. The default is <code>center</code>
:{{para|align|''value''}} is also available; where ''value'' can be either <code>right</code> or <code>left</code>. The default is <code>center</code>
Line 20: Line 16:
| {{#if:{{PROTECTIONLEVEL:edit}} |{{pp-template|docusage=yes}}
| {{#if:{{PROTECTIONLEVEL:edit}} |{{pp-template|docusage=yes}}
| {{#if:{{PROTECTIONLEVEL:move}} |{{pp-move|docusage=yes|small=yes}} }}
| {{#if:{{PROTECTIONLEVEL:move}} |{{pp-move|docusage=yes|small=yes}} }}
}} }}<noinclude>
}} }}
{{Documentation}}
</noinclude>

Latest revision as of 02:44, 12 May 2022

How to manage this template's initial visibility
To manage this template's visibility when it first appears, add the parameter:

|state=collapsed to show the template in its collapsed state, i.e. hidden apart from its titlebar – e.g. {{BASEPAGENAME |state=collapsed}}
|state=expanded to show the template in its expanded state, i.e. fully visible – e.g. {{BASEPAGENAME |state=expanded}}
|state=autocollapse to show the template in its collapsed state but only if there is another template of the same type on the page – e.g. {{BASEPAGENAME |state=autocollapse}}

Unless set otherwise (see the |state= parameter in the template's code), the template's default state is autocollapse.