Difference between revisions of "Template:Collapsible option/doc"

From blackwiki
Jump to navigation Jump to search
imported>Funandtrvl
(updte)
imported>Sardanaphalus
(backgrounds)
Line 5: Line 5:
 
It may be used on either the template page itself (wrapped within <tt><nowiki><noinclude></noinclude></nowiki></tt> tags), or on the template's {{tl|documentation subpage}}.
 
It may be used on either the template page itself (wrapped within <tt><nowiki><noinclude></noinclude></nowiki></tt> tags), or on the template's {{tl|documentation subpage}}.
  
==Usage==
 
 
===Indicating optional use of ''state'' name===
 
===Indicating optional use of ''state'' name===
 
If, in a template where {{tlc|collapsible option}} has been transcluded, that template's ''state'' parameter has been enabled such that it need not be named when the template is called{{spaced ndash}}i.e., the ''state'' parameter includes <code><nowiki>{{{1| }}}</nowiki></code>, e.g.:
 
If, in a template where {{tlc|collapsible option}} has been transcluded, that template's ''state'' parameter has been enabled such that it need not be named when the template is called{{spaced ndash}}i.e., the ''state'' parameter includes <code><nowiki>{{{1| }}}</nowiki></code>, e.g.:
Line 14: Line 13:
 
then:
 
then:
 
: <code><nowiki>{{collapsible option |statename=optional}}</nowiki></code>
 
: <code><nowiki>{{collapsible option |statename=optional}}</nowiki></code>
removes the instances of {{para|state}} from the {{tlc|collapsible option}} message, and will display as:
+
removes the instances of {{para|state}} from the {{tlc|collapsible option}} message, and will appear as:
{{-}}
+
<div style="clear:both;background:transparent;">
 
{{collapsible option |statename=optional}}
 
{{collapsible option |statename=optional}}
 +
</div>
  
 
===Changing default===
 
===Changing default===
 
To change the ''state'' default from "autocollapse", use either "collapsed" or "expanded", as in the following:
 
To change the ''state'' default from "autocollapse", use either "collapsed" or "expanded", as in the following:
{{-}}
+
{{clear}}
:<code><nowiki>{{Collapsible option |state=collapsed}}</nowiki></code><br>
+
: <code><nowiki>{{collapsible option |state=collapsed}}</nowiki></code>
+
This will appear as:
will display as:
+
<div style="clear:both;background:transparent;">
{{-}}
+
{{collapsible option |state=collapsed}}
{{collapsible option|state=collapsed}}
+
</div>
 
 
 
 
 
== See also ==
 
== See also ==
 
* {{tl|Collapsible lists option}}
 
* {{tl|Collapsible lists option}}
 
* {{tl|Collapsible sections option}}
 
* {{tl|Collapsible sections option}}
 
<!--Disabling per template as this does not generally appear to be used (and does not change if/when default state changed in template):
 
    Accepts the optional parameter <code>default</code> for cases when the template's default is not "autocollapsed"; it then displays its value instead of the "This" at the start of last sentence (bracketed).-->
 
  
 
<includeonly>
 
<includeonly>

Revision as of 13:47, 18 April 2014

The {{collapsible option}} template gives a standardised message for transclusion on template pages whose templates include a state parameter (through which their collapsibility may be managed).

It may be used on either the template page itself (wrapped within <noinclude></noinclude> tags), or on the template's {{documentation subpage}}.

Indicating optional use of state name

If, in a template where {{collapsible option}} has been transcluded, that template's state parameter has been enabled such that it need not be named when the template is calledTemplate:Spaced ndashi.e., the state parameter includes {{{1| }}}, e.g.:

|state = {{{state|{{{1|}}}}}}
or
|state = {{{state|{{{1|<noinclude>expanded</noinclude>}}}}}}
etc

then:

{{collapsible option |statename=optional}}

removes the instances of |state= from the {{collapsible option}} message, and will appear as:

Initial visibility: currently defaults to autocollapse

To set this template's initial visibility, the |state= parameter may be used:

  • |state=collapsed: {{Collapsible option|state=collapsed}} to show the template collapsed, i.e., hidden apart from its title bar
  • |state=expanded: {{Collapsible option|state=expanded}} to show the template expanded, i.e., fully visible
  • |state=autocollapse: {{Collapsible option|state=autocollapse}}
    • shows the template collapsed to the title bar if there is a {{navbar}}, a {{sidebar}}, or some other table on the page with the collapsible attribute
    • shows the template in its expanded state if there are no other collapsible items on the page

If the |state= parameter in the template on this page is not set, the template's initial visibility is taken from the |default= parameter in the Collapsible option template. For the template on this page, that currently evaluates to autocollapse.

Changing default

To change the state default from "autocollapse", use either "collapsed" or "expanded", as in the following:

{{collapsible option |state=collapsed}}

This will appear as:

Initial visibility: currently defaults to autocollapse

To set this template's initial visibility, the |state= parameter may be used:

  • |state=collapsed: {{Collapsible option|state=collapsed}} to show the template collapsed, i.e., hidden apart from its title bar
  • |state=expanded: {{Collapsible option|state=expanded}} to show the template expanded, i.e., fully visible
  • |state=autocollapse: {{Collapsible option|state=autocollapse}}
    • shows the template collapsed to the title bar if there is a {{navbar}}, a {{sidebar}}, or some other table on the page with the collapsible attribute
    • shows the template in its expanded state if there are no other collapsible items on the page

If the |state= parameter in the template on this page is not set, the template's initial visibility is taken from the |default= parameter in the Collapsible option template. For the template on this page, that currently evaluates to autocollapse.

See also