Template:Collapse

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.

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 documentation

This template, {{Collapse}}, creates a collapsible container for page content that would benefit from an (optional) ability to be hidden from view, with the ability to appear in either the collapsed or expanded state by default.

Usage

In its simplest functional use case, the template's invocation need only include the parameters for the container's title and contents, taking the form:

{{Collapse|title=Box title|content=The contents of the box…}}

Blank example blocks

With common parameters only

Below is an example of the template formatted as a block with the most commonly used parameters, plus guidance on valid values where applicable; please delete all unused parameters before saving if copied and pasted.

{{Collapse
 | title        =
 | expand       = <!-- 'no' to default to collapsed state, otherwise leave unset -->
 | background-c =
 | align        =
 | padding      =
 | content      = <!-- Box content goes here -->
}}

With all parameters

Below is an example of the template formatted as a block with all possible named parameters, plus guidance on valid values where applicable; please delete all unused parameters before saving if copied and pasted.

{{Collapse
 | title        =
 | expand       = <!-- 'no' to default to collapsed state, otherwise leave unset -->
 | background-c =
 | color        =
 | font-size    =
 | align        =
 | padding      =
 | width        =
 | margin       =
 | clear        = <!-- [ none | left | right ] -->
 | border-w     = <!-- [ thin | medium | thick ] or absolute length -->
 | border-s     = <!-- [ none | hidden | dotted | dashed | double | groove | ridge | inset | outset ] -->
 | border-c     =
 | header-align = <!-- [ start | end | left | right | justify | match-parent | justify-all ] -->
 | header-c     =
 | header-bw    = <!-- [ thin | medium | thick ] or absolute length -->
 | header-bs    = <!-- [ none | hidden | dotted | dashed | double | groove | ridge | inset | outset ] -->
 | header-bc    =
 | header-fc    =
 | header-fs    =
 | header-fw    = <!-- [ 100 | 200 | 300 | normal | 500 | 600 | bold | 800 | 900 ] -->
 | header-p     =
 | class        =
 | style        =
 | content      = <!-- Box content goes here -->
}}

TemplateData

This is the TemplateData documentation for this template used by VisualEditor and other tools.

Collapse

Category:Templates using TemplateData

Places page content that consumes excess vertical space or is likely to interest only a subset of readers within a collapsible box that can appear in either state by default, keeping it in place and accessible without detriment to the overall layout or readability

Template parameters

This template has custom formatting.

ParameterDescriptionTypeStatus
Titletitle 2

The heading which describes the box's contents and is the only thing shown when in the collapsed state

Default
{{PAGENAME}}
Example
Some additional technical details…
Linerequired
Contentcontent 1

The page content to appear within the collapsible box

Example
Lorem ipsum dolor sit amet,…
Contentrequired
Default expansion stateexpand

When assigned the value 'no', the container's default appearance becomes its collapsed state

Default
yes
Example
no
Booleanoptional
Title background colorheader-c

Background color of the box title's rectangular element, must be a valid CSS color value (named, hexadecimal code, RGB decimals, etc.)

Default
#eaecf0
Example
goldrenrod
Lineoptional
Background colorbackground-c

The background color for the box's contents, which also narrowly surrounds the title in the collapsed state; must be a valid CSS color value (named, hexadecimal code, RGB decimals, etc.).

Default
white
Example
#abcdef
Lineoptional
Title text colorheader-fc

Font text color of the box's title, must be a valid CSS color value (named, hexadecimal code, RGB decimals, etc.)

Default
black
Example
indigo
Lineoptional
Text colorcolor

Font text color of the box's content and, optionally, its title; must be a valid CSS color value (named, hexadecimal code, RGB decimals, etc.).

Default
#222
Example
dimgray
Lineoptional
Title font weightheader-fw

Sets the thickness of the title text font, must be an unsigned (positive) integer between 100 and 900, inclusive, or a relative CSS font-weight keyword

Suggested values
normal bold lighter bolder 100 200 300 400 500 600 700 800 900
Default
bold
Example
500
Lineoptional
Title text sizeheader-fs

Size of the box's title text font, must be a valid CSS length value with unit suffix or a relative size keyword

Suggested values
xx-small x-small small medium large x-large xx-large xxx-large
Default
0.95rem
Lineoptional
Text sizefont-size

Font size of the text content contained within the box, must be a valid CSS length value with unit suffix or a relative size keyword

Suggested values
xx-small x-small small medium large x-large xx-large xxx-large
Default
0.85rem
Lineoptional
Title alignmentheader-align

Sets the horizontal alignment of the box's title within its rectangular element

Suggested values
start end left right center justify match-parent justify-all
Default
center
Example
left
Lineoptional
Content alignmentalign

Sets the horizontal alignment of the box's contents

Suggested values
start end left right center justify match-parent justify-all
Default
none
Example
justify
Lineoptional
Title paddingheader-p

Sets the padding of the box title's rectangular element, or the distance from which it extends in all four directions beyond the title text; must be composed of 1–4 valid CSS length value(s) with unit suffix(es)

Default
0.15rem
Example
0.4rem
Lineoptional
Content paddingpadding

Defines the thickness of the null space between the box's contents and its borders, must be composed of 1–4 valid CSS length value(s) with unit suffix(es)

Default
0.4em 0.8em 0.2em
Example
1rem
Lineoptional
Widthwidth

The width of the collapsible box, either as an exact CSS length value with unit suffix or relative percentage of the page or viewport

Default
100%
Example
50vw
Lineoptional
Margin widthmargin

Defines the size of the collapsible box's margins from other elements on the page, must consist of 1–4 valid CSS length values with unit suffix

Suggested values
auto 0.25rem 0.5rem 0.75rem 1rem 1.25rem 1.5rem 1.75rem 2rem
Default
0.75rem auto 1.25rem
Example
1rem
Lineoptional
Float clearanceclear

Forces box to move below any floating elements on either or both page margins that prevent it from extending there

Suggested values
none left right both inline-start inline-end
Default
both
Example
both
Lineoptional
Title border widthheader-bw

Thickness of the box title rectangular element's border, must be a valid CSS length value with unit suffix or one of: 'thin', 'medium' or 'thick'

Suggested values
thin medium thick
Default
thin
Example
medium
Lineoptional
Border widthborder-w

Thickness of the box's outer border, must be a valid CSS length value with unit suffix or one of: 'thin', 'medium' or 'thick'

Suggested values
thin medium thick
Default
thin
Example
2px
Lineoptional
Title border styleheader-bs

Style of the box title rectangular element's border

Suggested values
none hidden dotted dashed solid double groove ridge inset outset
Default
solid
Example
ridge
Lineoptional
Border styleborder-s

Style of the box's outer border

Suggested values
none hidden dotted dashed solid double groove ridge inset outset
Default
solid
Example
double
Lineoptional
Title border colorheader-bc

Color of the box title rectangular elements's outer border, must be a valid CSS color value (named, hexadecimal code, RGB decimals, etc.)

Default
#a4aab080
Example
navy
Lineoptional
Border colorborder-c

Color of the box's outer border, must be a valid CSS color value (named, hexadecimal code, RGB decimals, etc.)

Default
#aaa
Example
darkslateblue
Lineoptional
Extra CSS classesclass

Adds additional class names to the top-level 'div' HTML container element

Example
toccolours
Lineoptional
Extra CSS style declarationsstyle

Defines additional CSS style declarations to be added to the collapsible container's outer table element, multiple declarations must be semicolon-delimited

Example
white-space: nowrap;
Stringoptional

See also

  • {{Hidden}} – functionally very similar, but with different aesthetics
  • {{Hidden archive top}} (and {{Hidden archive bottom}}) – also similar in function, but meant specifically for pages in Talk namespaces with an included admonition not to disturb the contents in the interests of maintaining a faithful archive of past events

These template pairs also produce a similar content container, but are more compatible with complex wiki markup structures:

Category:Formatting templates Category:Pages using the JsonConfig extension Category:Templates using TemplateData