Template:Collapse

From "PTTLink Wiki"
Revision as of 23:44, 6 November 2021 by Mediawiki>ExE Boss (Add line breaks between CSS properties in `style` attributes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Collapse

Template:Lorem ipsum

Template documentationview · edit · history · purge ]
This documentation is transcluded from Template:Collapse/doc.

This template creates a collapsible box.

The template automatically sets the following categories:

Usage

{{collapse |title= |1= }}

Template parameters

ParameterDescriptionDefaultStatus
titletitleThe always visible title of the collapsed box{{PAGENAME}}suggested
1contentHidden content of the box. If it includes an equal sign, be sure to use the {{collapsed|1=content}} form or replace the equal signs with =.emptyrequired
expandexpandWhether the box should be expanded (not collapsed) by default (anything apart from “no” means yes)nooptional
header-cheader background colorCSS color code or name of the background color of the header#f0f2f5optional
border-cborder colorCSS color code or name of the outer border of the whole box#aaaoptional
background-cbackground colorCSS color code or name of the background of the whole box#fffoptional
border-wborder widthCSS length of the width of the outer border of the whole box1pxoptional
border-sborder styleCSS border style of the outer border of the whole boxsolidoptional
font-sizegeneral font sizeCSS font size of the header and body text (relative values are relative to the context of the box)88%optional
header-fsheader font sizeCSS font size of the header text; overrides the general font size (relative values are still relative to the context of the box, not the general font size)emptyoptional
header-fcheader foreground colorCSS color code or name of the foreground (text) color of the header#000optional
widthwidthCSS length of the width of the box100%optional
alignbody text alignText alignment of the content: “left”, “right” or “center”. By default it inherits the context’s alignmentemptyoptional
header-alignheader text alignText alignment of the header: “left”, “right” or “center”. Explicit “center” enlarges left padding of the titlecenteroptional
clearclearThe side to clear on (i.e. prevent things floated to that side of the page from overlapping with the collapse box): “left”, “right”, “both” or “none”bothoptional
marginmarginCSS margin size of the whole boxautooptional
colorbody foreground colorCSS color code or name of the foreground (text) color of the body#222optional
classCSS classAdditional CSS classes for the whole boxemptyoptional
<templatedata>JSON</templatedata> ./. {{TemplateBox}}
TemplateData

TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.


Existing template documentation
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either ‎useTemplateData=1 or ‎useTemplateData=only on the ‎/doc subpage and transcluding it with {{Documentation}} into the template. <nowiki>-tags can be wrapped around the arguments, if required, to avoid templates being expanded.

Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw <templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.

Discussion
There is an ongoing discussion about that matter. Feel invited to comment if you are experienced in either way, your time permits and if you like to share your opinion or to make a suggestion.


Wikipedia's help about TemplateDataCommons-specific information

This template creates a collapsible box.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
content1

Hidden content of the box. If it includes an equal sign, be sure to use the “{{collapsed|1=''content''}}” form or replace the equal signs with “&amp;#61;”.

Contentrequired
body text alignalign

Text alignment of the content: “left”, “right” or “center”. By default it inherits the context’s alignment

Lineoptional
background colorbackground-c

CSS color code or name of the background of the whole box

Default
#fff
Lineoptional
border colorborder-c

CSS color code or name of the outer border of the whole box

Default
#aaa
Lineoptional
border styleborder-s

CSS border style of the outer border of the whole box

Default
solid
Lineoptional
border widthborder-w

CSS length of the width of the outer border of the whole box

Default
1px
Lineoptional
CSS classclass

Additional CSS classes for the whole box

Lineoptional
clearclear

The side to clear on (i.e. prevent things floated to that side of the page from overlapping with the collapse box): “left”, “right”, “both” or “none”

Default
both
Lineoptional
body foreground colorcolor

CSS color code or name of the foreground (text) color of the body

Default
#222
Lineoptional
expandexpand

Whether the box should be expanded (not collapsed) by default (anything apart from “no” means yes)

Default
no
Lineoptional
general font sizefont-size

CSS font size of the header and body text (relative values are relative to the context of the box)

Default
88%
Lineoptional
header text alignheader-align

Text alignment of the header: “left”, “right” or “center”. Explicit “center” enlarges left padding of the title

Default
center
Lineoptional
header background colorheader-c

CSS color code or name of the background color of the header

Default
#f0f2f5
Lineoptional
header foreground colorheader-fc

CSS color code or name of the foreground (text) color of the header

Default
#000
Lineoptional
header font sizeheader-fs

CSS font size of the header text; overrides the general font size (relative values are still relative to the context of the box, not the general font size)

Lineoptional
marginmargin

CSS margin size of the whole box

Default
auto
Lineoptional
titletitle

The always visible title of the collapsed box

Default
{{PAGENAME}}
Linesuggested
widthwidth

CSS length of the width of the box

Default
100%
Lineoptional

Additional information

The template is intended to be used in the following namespaces: all namespaces

The template is intended to be used by the following user groups: all users

⧼Seealso⧽

Localization

This template is not intended to be localized.