模板:Collapsible list
<templatestyles src="Module:Documentation/styles.css"></templatestyles>
| 文件:Lua-logo-nolabel.svg | 此模板使用Lua语言: |
This template produces a collapsible list. It is possible to set CSS styles for the "frame" (the <div>...</div> tags surrounding the list), for the list title, and for the list items. The template supports an unlimited number of list items.
This template is typically used in infoboxes and navboxes; it should not normally be used in regular article content, per MOS:DONTHIDE.
Regarding using this template in infoboxes, MOS:DONTHIDE acknowledges that "a few infoboxes also use pre-collapsed sections for infrequently accessed details. If [such] information ... seems extraneous or trivial enough to inspire pre-collapsing it, consider raising a discussion on the article (or template) talk page about whether it should be included at all."
<templatestyles src="Module:Sidebar/styles.css"></templatestyles><templatestyles src="Template:Helpbox/styles.css"></templatestyles>Syntax
<syntaxhighlight lang="html" style="font-size:95%;overflow:auto;">
</syntaxhighlight>
Parameters
| expand | Any text in this parameter (including "no") sets the list's default state to expanded rather than collapsed. Omit the parameter or leave it blank to set the default state to collapsed. |
| framestyle | Custom CSS styling applied the template overall (title and list). |
| titlestyle | Custom CSS styling applied to the title. |
| title | The list's title (always on view beside the list's [show/hide] link). |
| liststyle | Custom CSS styling applied to the list (specifically, to the <ul>...</ul> tags delimiting the list). |
| hlist | Include as |hlist=on, |hlist=true, etc to produce a horizontal rather than vertical list. |
| bullets | Include as |bullets=on, |bullets=true, etc to place a bullet point before each list item. |
| Unnamed parameters (first, second, third...) | The list items (in the order in which they will appear). If none are supplied, the template outputs nothing. |
Examples
<syntaxhighlight lang="Moin" style="font-size:95%;overflow:auto;">
</syntaxhighlight>
Example of a list without borders because it is within an infobox
In these examples, the fields leader_name2 and leader_name3 have been changed to use collapsible list.
<templatestyles src="Module:Infobox/styles.css"></templatestyles><templatestyles src="Infobox settlement/styles.css"></templatestyles>City of Hamilton | |
|---|---|
| 文件:HamiltonOntarioSkylineC.JPG | |
| Motto: Together Aspire – Together Achieve | |
| 模板:Ifnoerror then show | |
| Country | Canada |
| Province | Ontario |
| Incorporated | June 9, 1846 |
| Government | |
| • Mayor | Fred Eisenberger |
| • City Council | Hamilton, Ontario, City Council |
| • MPs | |
| • MPPs | |
| Population | 模板:Fix comma category |
<syntaxhighlight lang="html" style="font-size:95%; overflow:auto;">
<templatestyles src="Module:Infobox/styles.css"></templatestyles><templatestyles src="Infobox settlement/styles.css"></templatestyles>City of Hamilton
...truncated... | |
|---|---|
| 模板:Ifnoerror then show | |
| Incorporated | June 9, 1846 (...etc...) |
| Government | |
| • Mayor | Fred Eisenberger |
| • City Council | Hamilton City Council |
| • MPs | |
| • MPPs | |
| Population | 模板:Fix comma category |
</syntaxhighlight>
TemplateData
TemplateData for Collapsible list
Produces an HTML list that can be collapsed
| 参数 | 描述 | 类型 | 状态 | |
|---|---|---|---|---|
| Title | title | The list's title (Always in view beside the list's [show/hide] link). | 字符串 | 推荐 |
| Horizontal list | hlist | Use value 'on' or 'true' to produce a horizontal rather than vertical list
| 字符串 | 可选 |
| Bullets | bullets | Set as 'on' or 'true' to place a bullet point before each list item
| 字符串 | 可选 |
| Expand list | expand | Expand the list instead of collapsing it
| 字符串 | 可选 |
| First list item | 1 | A single list item | 内容 | 推荐 |
| Frame style | framestyle frame_style | Custom CSS styling applied the template overall (title and list).
| 字符串 | 可选 |
| Title style | titlestyle title_style | CSS styling applied to the title
| 字符串 | 可选 |
| List style | liststyle list_style | CSS styling applied solely to the list itself
| 字符串 | 可选 |
| Second list item | 2 | A single list item | 内容 | 推荐 |
| Third list item | 3 | A single list item | 内容 | 推荐 |
| Fourth list item | 4 | A single list item | 内容 | 可选 |
| 5 | 5 | 无描述 | 内容 | 可选 |
| 6 | 6 | 无描述 | 内容 | 可选 |
| 7 | 7 | 无描述 | 内容 | 可选 |
| 8 | 8 | 无描述 | 内容 | 可选 |
| 9 | 9 | 无描述 | 内容 | 可选 |
| 10 | 10 | 无描述 | 内容 | 可选 |