This page is semi-protected against editing.

Template:Collapse: Difference between revisions

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Content deleted Content added
mNo edit summary
No edit summary
Line 1: Line 1:
<onlyinclude>
<onlyinclude>{|class="mw-collapsible mw-{{{{{|safesubst:}}}#ifeq:{{{expand|<includeonly>no</includeonly>}}}|no||un}}collapsed {{{class|}}}" style="<!--
{|class="mw-collapsible mw-{{{{{|safesubst:}}}#ifeq:{{{expand|<includeonly>no</includeonly>}}}|no||un}}collapsed {{{class|}}}" style="<!--
-->clear:{{{clear|both}}};<!--
-->clear:{{{clear|both}}};<!--
-->margin:{{{margin|2px auto}}};<!--
-->margin:{{{margin|2px auto}}};<!--

Revision as of 22:38, 3 December 2023

Collapse
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
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 &#61;.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.


Wikipedia's help about TemplateDataCommons-specific information

This template creates a collapsible box.

Template parameters[Edit template data]

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

See also

Localization

This template is not intended to be localized.