Template:Navbox with collapsible groups/doc
{{#invoke:sidebar|sidebar
| width = auto
| bodystyle = border-spacing:0;background:#f7f7f7;padding:2px;
| titleclass = navbox-title
| title = Navbox suite
| contentclass = plainlist
| contentstyle = padding:0.25em;background:#fdfdfd;
| content1 =
- {{Navbox}}
- {{Navbox subgroup}}
- {{Navbox with collapsible groups}}
- {{Navbox with columns}}
- {{Navboxes}}
| navbarstyle = background:#fdfdfd;padding:0 5px }}
This template produces a navigation template that has groups of relevant articles on a certain topic. All groups are hidden by default. However, with a parameter call, an individual group can be shown that has the other articles in the same group.
Contents
Usage
Please remove the parameters that are left blank. The template currently supports up to 20 groups/lists but more can be added if needed. You should use a minimum of two groups/lists; otherwise, use {{Navbox}} instead.
{{Navbox with collapsible groups | name = {{subst:PAGENAME}} | state = {{{state|}}} | titlestyle = | title = | image = | listclass = hlist | selected = {{{selected|{{{1|}}}}}} | abbr1 = | group1 = | content1 = | abbr2 = | group2 = | content2 = <!--[etc, to:]--> | abbr20 = | group20 = | list20 = }}
Parameters
This template shares many common parameters with its sister templates {{Navbox}} and {{Navbox with columns}}. The common parameters are marked with a cross†. Please refer to the documentation of {{Navbox}} for more in depth descriptions and examples of those parameters.
Setup parameters
- name†
- The name of the template. The name of this template, for example, is "Navbox with collapsible groups".
- state† [
uncollapsed, collapsed, plain, off
] - The initial state of the show/hide feature for the main title. See {{Navbox}} for more information. Does not affect display or hiding of group items, see staten, below.
- state† [
- navbar†
- Possible values are
plain
,off
, and the default value of blank. See {{Navbox}} for more information.
- border†
- Possible values are
child
,none
, and the default value of blank. Set tochild
if you wish to use the navbox inside of another navbox; with this option, the child navbox is borderless and fits snuggly inside of its parent navbox. The parent navbox may be the list area of {{Navbox}}, the columns of a {{Navbox with columns}}, or a list area of {{Navbox with collapsible groups}}. See {{Navbox}} for more information and examples.
Basic data parameters
- title†
- The title of the template, displayed centered in the titlebar at the top of the template.
- above†
- Text or other elements to appear above groups/lists.
- image†
- Image to the right of all of the groups/lists.
- imageleft†
- Image to the left of all of the groups/lists.
- below†
- Text or other elements to appear below the groups/lists.
Group/list parameters
- groupn†
- The title of each section.
- listn†
- The content/wikilinks that will be shown in the group.
Use dots or bullets as separators (see the See also section).A {{Navbox}} or {{Navbox with columns}} can optionally be used here with itsborder = child
parameter set. If this is done, leave the corresponding groupn blank, as the child navbox will already provide the collapsible feature.
- abbrn
- This is the abbreviation of the group. See
selected
parameter immediately below to see how to use this parameter. This parameter is optional, but recommended.
- selected
- If the value of
selected
equals the value ofabbrn
, then listn is uncollapsed and all other lists are collapsed. Ifselected
is left blank, or if it does not match anyabbrn
, then all groups are collapsed. Usually this parameter should be set to {{{1|}}}. Since this template is a base template for others, there has to be a way to pass the group parameter from the article, to the secondary template to this one.
- The collapsed/uncollapsed options can be listed on the template's page by using the {{Collapsible sections option}} template in the <noinclude> part of the page.
- staten [
uncollapsed, collapsed, plain, off
] - The initial collapsible state of listn. Set to collapsed by default. Overridden to uncollapsed if
selected
equalsabbrn
.
- staten [
- imagen
- An image to appear in the listn content area on the right side.
- imageleftn
- An image to appear in the listn content area on the left side.
Style parameters
- bodystyle†
- CSS style/s to apply to the entire template
- titlestyle†
- CSS style/s to apply to titlebar; usually
background:color
. The color of wikilink text must be manually changed using span tags. For example usetitle = [[Scouting|<span style="color:ivory;">Scouting</span>]]
to change the color of the link to ivory. The [show]/[hide] button and the vde link button use the color set in the titlestyle parameter. Here is an example of setting the titlestyle:titlestyle = background:darkgreen;color:ivory;
- abovestyle†
- belowstyle†
- CSS style/s to apply to the above and below parameters, respectively.
- basestyle†
- CSS style/s to apply to the title, above, below, and groupn parameters, all at the same time.
- imagestyle†
- CSS style/s to apply to the image parameter. Does not get applied to the imagen parameters.
- imageleftstyle†
- CSS style/s to apply to the imageleft parameter. Does not get applied to the imageleftn parameters.
- groupstyle†
- CSS style/s to apply to all group heading parameters. Visit this website to get a lighter color similar to the title background color. Example:
groupstyle = background:lightgreen;
- groupnstyle†
- CSS style/s to apply to a specific group heading; overrides any CSS styles set in groupstyle.
- liststyle†
- CSS style/s to apply to all list content parameters.
- listnstyle†
- CSS style/s to apply to specific list content parameters; overrides any CSS styles set in liststyle.
- listpadding†
- Padding to have in each list cell; defaults to 0.25em on the left/right and 0em on the top/bottom.
Microformat parameters
- bodyclass†
- This parameter is inserted into the "class" attribute for the infobox as a whole.
- titleclass†
- This parameter is inserted into the "class" attribute for the infobox's title caption.
- See Wikipedia:WikiProject Microformats for more information on adding microformat information to Wikipedia, and microformat for more information on microformats in general.
Examples
Basic example
{{Navbox with collapsible groups |name = University of Michigan |state = uncollapsed |title = [[University of Michigan|<span style="color:#FFD700;">The University of Michigan, Ann Arbor</span>]] |titlestyle = background:#00008B;color:#FFD700; |listclass = hlist |groupstyle = background:#FFD700;color:#00008B; |image = |selected = {{{1|}}} |group1 = [[University of Michigan#Academic profile|<span style="color:#00008B;">Academics</span>]] |abbr1 = academics |list1 = *[[University of Michigan College of Engineering|College of Engineering]] *[[University of Michigan College of Literature, Science, and the Arts|College of Literature, Science and the Arts]] *[[Gerald R. Ford School of Public Policy]] *[[University of Michigan Law School|Law School]] *[[University of Michigan Health System|Medical School]] *[[Ross School of Business]] *[[University of Michigan School of Education|School of Education]] *[[University of Michigan School of Information|School of Information]] *[[University of Michigan School of Music, Theatre & Dance|School of Music, Theatre & Dance]] *[[University of Michigan School of Natural Resources and Environment|School of Natural Resources and Environment]] *[[University of Michigan School of Public Health|School of Public Health]] *[[Taubman College of Architecture and Urban Planning]] |group2 = [[Michigan Wolverines|<span style="color:#00008B;">Athletics</span>]] |abbr2 = athletics |state2 = uncollapsed |list2 = *[[Michigan Stadium]] *[[Crisler Arena]] *[[Yost Ice Arena]] *[[Michigan Wolverines]] *[[Michigan Wolverines football|Football]] *[[Michigan – Ohio State football rivalry|UM-OSU Rivalry]] *[[Little Brown Jug (American football)|Little Brown Jug]] *[[Paul Bunyan Trophy]] *[[Cold War (ice hockey)|Cold War]] |group3 = Campus |abbr3 = campus |list3 = *[[Angell Hall Observatory]] *[[Burton Memorial Tower|Burton Tower]] *[[The Diag]] *[[David M. Dennison Building|Dennison Building]] *[[Gerald R. Ford Presidential Library]] *[[Hill Auditorium]] *[[Lurie Tower]] *[[Matthaei Botanical Gardens]] *[[Michigan Union]] *[[Museums at the University of Michigan|Museums]] *[[Nichols Arboretum]] *[[University of Michigan Health System|UM Health System]] *[[University of Michigan Library|University Library]] }}
{{#invoke:navbox|navbox |name = University of Michigan |navbar = |state = uncollapsed |border =
|title = The University of Michigan, Ann Arbor |above = |image = |imageleft =
|bodyclass = |titleclass = |aboveclass = |belowclass = |groupclass = |listclass = hlist |imageclass =
|style = |basestyle = |titlestyle = background:#00008B;color:#FFD700; |abovestyle = |belowstyle = |imagestyle = |imageleftstyle =
|list1 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ;background:#FFD700;color:#00008B; |liststyle = |title = Academics |list1 = *College of Engineering
- College of Literature, Science and the Arts
- Gerald R. Ford School of Public Policy
- Law School
- Medical School
- Ross School of Business
- School of Education
- School of Information
- School of Music, Theatre & Dance
- School of Natural Resources and Environment
- School of Public Health
- Taubman College of Architecture and Urban Planning
|image = |imageleft = |void = }}
|list2 = {{#invoke:navbox|navbox|child
|navbar = plain |state = uncollapsed |titlestyle = ;background:#FFD700;color:#00008B; |liststyle = |title = Athletics |list1 = *Michigan Stadium
- Crisler Arena
- Yost Ice Arena
- Michigan Wolverines
- Football
- UM-OSU Rivalry
- Little Brown Jug
- Paul Bunyan Trophy
- Cold War
|image = |imageleft = |void = }}
|list3 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ;background:#FFD700;color:#00008B; |liststyle = |title = Campus |list1 = *Angell Hall Observatory
- Burton Tower
- The Diag
- Dennison Building
- Gerald R. Ford Presidential Library
- Hill Auditorium
- Lurie Tower
- Matthaei Botanical Gardens
- Michigan Union
- Museums
- Nichols Arboretum
- UM Health System
- University Library
|image = |imageleft = |void = }}
|list4 =
|list5 =
|list6 =
|list7 =
|list8 =
|list9 =
|list10 =
|list11 =
|list12 =
|list13 =
|list14 =
|list15 =
|list16 =
|list17 =
|list18 =
|list19 =
|list20 =
|below =
}}
This example shows {{Navbox}}, {{Navbox with collapsible groups}} and {{Navbox with columns}} all working together. Press the edit button for the section to view the code. Note that each of the child navboxes has the first parameter set to child
{{#invoke:navbox|navbox
|name = Navbox with collapsible groups/doc#Nesting other Navbox forms
|navbar =
|state =
|border =
|title = Navbox, Navbox with columns, and Navbox with collapsible groups together |above = |image = |imageleft =
|bodyclass = |titleclass = |aboveclass = |belowclass = |groupclass = |listclass = hlist |imageclass =
|style = |basestyle = |titlestyle = |abovestyle = |belowstyle = |imagestyle = |imageleftstyle =
|list1 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ; |liststyle = |title = The Scouting Movement |list1 = *Scouting
- Scouting for Boys
- Scout method
- Scout Law
- Scout Promise
- Scout Motto
- Wood Badge
- Age groups in Scouting and Guiding
- Cub Scout
- Boy Scout
- Rover Scout
- Brownie
- Girl Guiding and Girl Scouting
- Ranger (Girl Guide)
- Jamboree
- Scout Leader
- WOSM
- WAGGGS
- Non-aligned organisations
- Scouting controversy and conflict
- Scouting in popular culture
- List of Scouts
- List of highest awards in Scouting
|image = |imageleft = |void = }}
|list2 =
| |
---|---|
Mahgreb | |
French West Africa | |
French Equatorial Africa | |
Comoros | |
|list3 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ; |liststyle = |title = Scouting in the United Kingdom |list1 = *The Scout Association
- Girlguiding UK
- Beaver Scouts
- Cub Section (UK)
- Venture Scout
- Explorer Scouts
- Brownie (Girl Guides)
- Ranger (Girl Guide)
- Rainbow (Girl Guides)
- Scout Network
- Chief Scout (United Kingdom)
- Scout Counties
- Scout District
- Scout Section (UK)
- Scout Activity Centre
- Young Leaders
|image = |imageleft = |void = }}
|list4 =
| ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|list5 =
|list6 =
|list7 =
|list8 =
|list9 =
|list10 =
|list11 =
|list12 =
|list13 =
|list14 =
|list15 =
|list16 =
|list17 =
|list18 =
|list19 =
|list20 =
|below =
}}
You can conveniently nest Navboxes, including {{Navbox with collapsible groups}}, to get an unlimited number of groups/lists. The following example uses one instance of {{Navbox with collapsible groups}} to get the first 10 collapsible groups, a nested instance to get the next 10, and another nested instance to get the last 6. See the code to learn how it works. It is fairly simple to extend this to as many groups/lists as you like:
{{#invoke:navbox|navbox |name = Navbox with collapsible groups/doc |navbar = |state = collapsed |border =
|title = Title |above = |image = |imageleft =
|bodyclass = |titleclass = |aboveclass = |belowclass = |groupclass = |listclass = |imageclass =
|style = |basestyle = |titlestyle = |abovestyle = |belowstyle = |imagestyle = |imageleftstyle =
|list1 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ; |liststyle = |title = A |list1 = List A |image = |imageleft = |void = }}
|list2 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ; |liststyle = |title = B |list1 = List B |image = |imageleft = |void = }}
|list3 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ; |liststyle = |title = C |list1 = List C |image = |imageleft = |void = }}
|list4 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ; |liststyle = |title = D |list1 = List D |image = |imageleft = |void = }}
|list5 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ; |liststyle = |title = E |list1 = List E |image = |imageleft = |void = }}
|list6 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ; |liststyle = |title = F |list1 = List F |image = |imageleft = |void = }}
|list7 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ; |liststyle = |title = G |list1 = List G |image = |imageleft = |void = }}
|list8 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ; |liststyle = |title = H |list1 = List H |image = |imageleft = |void = }}
|list9 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ; |liststyle = |title = I |list1 = List I |image = |imageleft = |void = }}
|list10 = {{#invoke:navbox|navbox |name = |navbar = |state = |border = child
|title =
|above =
|image =
|imageleft =
|bodyclass = |titleclass = |aboveclass = |belowclass = |groupclass = |listclass = |imageclass =
|style = |basestyle = |titlestyle = |abovestyle = |belowstyle = |imagestyle = |imageleftstyle =
|list1 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ; |liststyle = |title = J |list1 = List J |image = |imageleft = |void = }}
|list2 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ; |liststyle = |title = K |list1 = List K |image = |imageleft = |void = }}
|list3 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ; |liststyle = |title = L |list1 = List L |image = |imageleft = |void = }}
|list4 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ; |liststyle = |title = M |list1 = List M |image = |imageleft = |void = }}
|list5 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ; |liststyle = |title = N |list1 = List N |image = |imageleft = |void = }}
|list6 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ; |liststyle = |title = O |list1 = List O |image = |imageleft = |void = }}
|list7 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ; |liststyle = |title = P |list1 = List P |image = |imageleft = |void = }}
|list8 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ; |liststyle = |title = Q |list1 = List Q |image = |imageleft = |void = }}
|list9 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ; |liststyle = |title = R |list1 = List R |image = |imageleft = |void = }}
|list10 = {{#invoke:navbox|navbox |name = |navbar = |state = |border = child
|title =
|above =
|image =
|imageleft =
|bodyclass = |titleclass = |aboveclass = |belowclass = |groupclass = |listclass = |imageclass =
|style = |basestyle = |titlestyle = |abovestyle = |belowstyle = |imagestyle = |imageleftstyle =
|list1 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ; |liststyle = |title = S |list1 = List S |image = |imageleft = |void = }}
|list2 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ; |liststyle = |title = T |list1 = List T |image = |imageleft = |void = }}
|list3 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ; |liststyle = |title = U |list1 = List U |image = |imageleft = |void = }}
|list4 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ; |liststyle = |title = V |list1 = List V |image = |imageleft = |void = }}
|list5 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ; |liststyle = |title = W |list1 = List W |image = |imageleft = |void = }}
|list6 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ; |liststyle = |title = X |list1 = List X |image = |imageleft = |void = }}
|list7 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ; |liststyle = |title = Y |list1 = List Y |image = |imageleft = |void = }}
|list8 = {{#invoke:navbox|navbox|child
|navbar = plain |state = collapsed |titlestyle = ; |liststyle = |title = Z |list1 = List Z |image = |imageleft = |void = }}
|list9 =
|list10 =
|list11 =
|list12 =
|list13 =
|list14 =
|list15 =
|list16 =
|list17 =
|list18 =
|list19 =
|list20 =
|below =
}}
|list11 =
|list12 =
|list13 =
|list14 =
|list15 =
|list16 =
|list17 =
|list18 =
|list19 =
|list20 =
|below =
}}
|list11 =
|list12 =
|list13 =
|list14 =
|list15 =
|list16 =
|list17 =
|list18 =
|list19 =
|list20 =
|below =
}}
See also
- {{Collapsible sections option}}
-
{{Nowrap begin}} – Provides an explanation of the preferred method of using bullets or pipes to delimit list items.Deprecated; use thehlist
class.
Collapsible | Header color | Image | Groups | Style (body) parameter/s |
Examples | |
---|---|---|---|---|---|---|
{{Navbox}} | collapsible | navbox | Left/right of body | Yes | Yes | |
{{Navbox with collapsible groups}} | collapsible | navbox | Left/right of body and/or in each list | Yes | Yes |
|
{{Navbox with columns}} | collapsible | navbox | Left/right of columns | No | Yes |
Type | CSS classes | JavaScript | Collapses when | Custom initial state |
Nesting |
---|---|---|---|---|---|
Collapsible tables | collapsible | Defined in Common.js | 2 or more autocollapse on page | Yes | Yes |