Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Collapsible option/doc: Difference between revisions

Template page
Created page with "{{Documentation subpage}} <!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata --> {{High-use|demo={{ROOTPAGENAME}}}} {{tlx|Collapsible option}} is a utility template that provides a standardised message for transclusion on template documentaion pages for templates whose collapsibility may be managed by the parameter {{para|state}}. It can be used on either the template page..."
 
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{wikipedia|page name}}
{{Documentation subpage}}
{{Documentation subpage}}
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata -->
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata -->
{{High-use|demo={{ROOTPAGENAME}}}}
{{tlx|Collapsible option}} is a utility template that provides a standardised message for transclusion on template documentaion pages for templates whose collapsibility may be managed by the parameter {{para|state}}.
{{tlx|Collapsible option}} is a utility template that provides a standardised message for [[Help:Transclusion|transclusion]] on [[Wikipedia:Template documentation|template documentaion]] pages for templates whose collapsibility may be managed by the parameter {{para|state}}.


It can be used on either the template page itself (wrapped within {{tag|noinclude}} tags), but it is almost always better to place it in the template's {{tlx|documentation subpage}}.
It can be used on either the template page itself (wrapped within {{tag|noinclude}} tags), but it is almost always better to place it in the template's {{tlx|documentation subpage}}.


===Indicating optional use of {{samp|state}} name===
===Indicating optional use of {{samp|state}} name===
{{Update|inaccurate=yes|date=December 2024|reason=Removed in [[Special:Diff/657041913|2015]]|talk=Broken_statename_parameter}}
{{Update|inaccurate=yes|date=December 2024|reason=Removed in 2015|talk=Broken_statename_parameter}}
The {{para|state}} parameter used to manage collapsible templates need not always be named explicitly, i.e. {{tnull|{{var|Template name}}{{!}}{{var|state}}}} can be the same as {{tnull|{{var|Template name}}|state{{=}}{{var|state}}}}, if the template is coded that way. To indicate this in the {{tnull|Collapsible option}} message, add the parameter {{para|statename|optional}}. This modifies the message so that it reads (if it were used for itself):
The {{para|state}} parameter used to manage collapsible templates need not always be named explicitly, i.e. {{tnull|{{var|Template name}}{{!}}{{var|state}}}} can be the same as {{tnull|{{var|Template name}}|state{{=}}{{var|state}}}}, if the template is coded that way. To indicate this in the {{tnull|Collapsible option}} message, add the parameter {{para|statename|optional}}. This modifies the message so that it reads (if it were used for itself):


Line 17: Line 17:
*<code><nowiki>{{{1|}}}</nowiki></code> as part of a collapsible template's {{para|state}} parameter{{spaced ndash}}for instance, as {{para|state|<nowiki>{{{state|{{{1|}}}}}}</nowiki>}} or {{para|state|<nowiki>{{{state|{{{1|<noinclude>expanded</noinclude>}}}}}}</nowiki>}}, etc.
*<code><nowiki>{{{1|}}}</nowiki></code> as part of a collapsible template's {{para|state}} parameter{{spaced ndash}}for instance, as {{para|state|<nowiki>{{{state|{{{1|}}}}}}</nowiki>}} or {{para|state|<nowiki>{{{state|{{{1|<noinclude>expanded</noinclude>}}}}}}</nowiki>}}, etc.
*<code><nowiki><noinclude></nowiki></code>,<code><nowiki><includeonly></nowiki></code>as part of a collapsible template's <code>state</code> argument{{spaced ndash}}for instance, as {{para|state|<nowiki>{{{state<includeonly>|collapsed</includeonly>}}}</nowiki>}}
*<code><nowiki><noinclude></nowiki></code>,<code><nowiki><includeonly></nowiki></code>as part of a collapsible template's <code>state</code> argument{{spaced ndash}}for instance, as {{para|state|<nowiki>{{{state<includeonly>|collapsed</includeonly>}}}</nowiki>}}
If, however, the template includes collapsible sections within itself (e.g. {{tlx|Navbox with collapsible groups}}), then enabling this possibility may introduce ambiguity as regards what is to be collapsed or expanded. In those instances, therefore, the requirement to use {{para|state}} should be retained.
If, however, the template includes collapsible sections within itself (e.g. ), then enabling this possibility may introduce ambiguity as regards what is to be collapsed or expanded. In those instances, therefore, the requirement to use {{para|state}} should be retained.


===Changing the default state===
===Changing the default state===
To change the default state {{tnull|Collapsible option}} uses, add the parameter {{para|default|collapsed}} or {{para|default|expanded}} accordingly. To restore the default, remove any {{para|default}} previously included.
To change the default state {{tnull|Collapsible option}} uses, add the parameter {{para|default|collapsed}} or {{para|default|expanded}} accordingly. To restore the default, remove any {{para|default}} previously included.


The {{para|default|collapsed}} option must not be used in main article content in mainspace, e.g. to hide [[Wikipedia:Manual of Style/Tables|tables of information]], or to cram extraneous details into [[Wikipedia:Manual of Style/Infoboxes|infoboxes]]. {{crossref|printworthy=y|(For more information, see {{section link|Wikipedia:Manual of Style#Scrolling lists and collapsible content}}.)}} This option {{em|is}} permissible in [[Wikipedia:Navigation template|navboxes]], which are not part of the article content {{lang|la|per se}}.
The {{para|default|collapsed}} option must not be used in main article content in mainspace, e.g. to hide tables of information, or to cram extraneous details into Wikipedia:Manual of Style/Infoboxes|infoboxes. {{crossref|printworthy=y|(For more information, see {{section link|Wikipedia:Manual of Style#Scrolling lists and collapsible content}}.)}} This option {{em|is}} permissible in navboxes, which are not part of the article content {{lang|la|per se}}.


===Slashes and the {{samp|nobase}} parameter ===
===Slashes and the {{samp|nobase}} parameter ===
If the template name given to {{tnull|Collapsible option}} includes a forward-slash (virgule) character – <kbd>/</kbd> – then the parameter {{para|nobase}} (set to {{kbd|on}}, {{kbd|true}}, etc.) will need to be added so that the name is displayed correctly (i.e., so that {{tlc|PAGENAME}} rather than the default {{tlc|BASEPAGENAME}} is used to display it).
If the template name given to {{tnull|Collapsible option}} includes a forward-slash (virgule) character – <kbd>/</kbd> – then the parameter {{para|nobase}} (set to , , etc.) will need to be added so that the name is displayed correctly (i.e., so that {{tlc|PAGENAME}} rather than the default {{tlc|BASEPAGENAME}} is used to display it).


== See also ==
== See also ==
Line 31: Line 31:
* {{tl|Collapsible lists option}}
* {{tl|Collapsible lists option}}
* {{tl|Collapsible sections option}}
* {{tl|Collapsible sections option}}
* [[Help:Collapsing tables and more|Collapsing tables and more]]
* Collapsing tables and more


<includeonly>{{Sandbox other||
<includeonly>{{Sandbox other||

Latest revision as of 06:27, 14 April 2025

This page uses Creative Commons Licensed content from Wikipedia (view authors).

{{Collapsible option}} is a utility template that provides a standardised message for transclusion on template documentaion pages for templates whose collapsibility may be managed by the parameter |state=.

It can be used on either the template page itself (wrapped within <noinclude>...</noinclude> tags), but it is almost always better to place it in the template's {{documentation subpage}}.

Indicating optional use of state name

Template:Update The |state= parameter used to manage collapsible templates need not always be named explicitly, i.e. {{Template name|state}} can be the same as {{Template name|state=state}}, if the template is coded that way. To indicate this in the {{Collapsible option}} message, add the parameter |statename=optional. This modifies the message so that it reads (if it were used for itself):

This template's initial visibility currently defaults to autocollapse, meaning that if there is another collapsible item on the page (a navbox, sidebar, or table with the collapsible attribute), it is hidden apart from its title bar; if not, it is fully visible.

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

  • {{Collapsible option|state=collapsed}} will show the template collapsed, i.e. hidden apart from its title bar.
  • {{Collapsible option|state=expanded}} will show the template expanded, i.e. fully visible.

This possibility is enabled by including:

  • {{{1|}}} as part of a collapsible template's |state= parameterTemplate:Spaced ndashfor instance, as |state={{{state|{{{1|}}}}}} or |state={{{state|{{{1|<noinclude>expanded</noinclude>}}}}}}, etc.
  • <noinclude>,<includeonly>as part of a collapsible template's state argumentTemplate:Spaced ndashfor instance, as |state={{{state<includeonly>|collapsed</includeonly>}}}

If, however, the template includes collapsible sections within itself (e.g. ), then enabling this possibility may introduce ambiguity as regards what is to be collapsed or expanded. In those instances, therefore, the requirement to use |state= should be retained.

Changing the default state

To change the default state {{Collapsible option}} uses, add the parameter |default=collapsed or |default=expanded accordingly. To restore the default, remove any |default= previously included.

The |default=collapsed option must not be used in main article content in mainspace, e.g. to hide tables of information, or to cram extraneous details into Wikipedia:Manual of Style/Infoboxes|infoboxes.

This option is permissible in navboxes, which are not part of the article content per se.

Slashes and the nobase parameter

If the template name given to {{Collapsible option}} includes a forward-slash (virgule) character – / – then the parameter |nobase= (set to , , etc.) will need to be added so that the name is displayed correctly (i.e., so that {{PAGENAME}} rather than the default {{BASEPAGENAME}} is used to display it).

See also