Changes

Jump to navigation Jump to search
update until this template can be rewritten to use Module:Navbox directly
{{Documentation subpage}}
{{Intricate template}}
{{Template display|nomobile}}
<!-- EDIT TEMPLATE DOCUMENTATION BELOW THIS LINE -->
{{Navbox suite}}
{{Deprecated template|Navbox subgroup|Navbox|note={{tld|Navbox subgroup}} is functionally equivalent to {{tld|Navbox|subgroup}}, but the later is more efficient (since it doesn't use an additional template layer) and allows for more than 20 list items.}}
This template was designed to be used with {{tl|Navbox}} or other [[Wikipedia:Navigation template|navigation template]]s that allow creating lists of links with groups headers or titles. This template allows for the creation of up to 20 subgroups that can be assigned to a list item within {{tl|Navbox}}. For 20 subgroups or fewer, this template is functionally equivalent to {{tld|Navbox|subgroup}}, but is less efficient since it uses an additional template layer. Hence, it is recommended to use {{tld|Navbox|subgroup}} instead.

== Blank template ==
<pre>
{{Navbox subgroup
| groupstyle =
| liststyle =

| group1 =
| list1 =
| group2 =
| list2 =
...
| group20 =
| list20 =
}}
</pre>

== Parameters ==
This template employs all parameters of {{tl|Navbox}}. Please see the documentation there for more complete descriptions. In fact, the only differences between this template and {{tl|Navbox}} are as follows:
*The border parameter defaults to "child"
*The group padding defaults to 0.75em on the left/right, and can only be changed with the <code>grouppadding</code> parameter. This is done to prevent the [[Internet Explorer box model bug]] from affecting the width of groups.
Everything else is ''exactly'' the same as {{tl|Navbox}}.

Only the most common parameters are listed below.

=== Cells ===
:; ''list<sub>n</sub>''
:: (i.e. ''list1'', ''list2'', ... ''list20'') The body of the template, usually a list of links. Format is inline. At least one ''list'' parameter is required; each additional ''list'' is displayed in a separate row of the table. Each ''list<sub>n</sub>'' may be preceded by a corresponding ''group<sub>n</sub>'' parameter, if provided (see below).

:; ''group<sub>n</sub>''
:: (i.e. ''group1'', ''group2'', ..., ''group20'') If specified, text appears in a header cell displayed to the left of ''list<sub>n</sub>''. If omitted, ''list<sub>n</sub>'' uses the full width of the table. The background color defaults to <code><span style="background:#e6e6ff; color:black;">#e6e6ff</span></code>, but can be changed via the ''groupstyle'' parameter (see below).

=== Styles ===
:; ''bodystyle''
:: Specifies [[Cascading Style Sheets|CSS]] styles to apply to the template body. Examples:
::: <code>background:#''nnnnnn'';</code>
::: <code>text-align:[''right/center/left/justified''];</code>

:; ''groupstyle''
:: CSS styles to apply to the ''group<sub>n</sub>'' cells. This option overrides any styles that are applied to the entire table. Examples:
::: <code>background:#''nnnnnn'';</code>
::: <code>text-align:[''left/center/right''];</code>
::: <code>vertical-align:[''top/middle/bottom''];</code>
::: <code>white-space:nowrap;</code>

:; ''grouppadding''
:: CSS style to specify group padding. Should usually be specified using em units. It is recommended to leave this parameter alone and use the default padding. Examples:
::: <code>grouppadding = 0em 1em;</code> (1em on left/right, 0em on top/bottom)
::: <code>grouppadding = 0em 0.5em 0em 1em;</code> (0em top, 0.5em right, 0em bottom, 1em left)

:; ''liststyle''
:: CSS styles to apply to all lists. Overridden by the ''oddstyle'' and ''evenstyle'' parameters (if specified) below.

:; ''oddstyle''
:; ''evenstyle''
:: CSS styles to apply to the odd-numbered list items (''list1'', ''list3'', etc) or even-numbered list items (''list2'', ''list4'', etc), respectively. Typically used to set background color (<code>background:#''nnnnnn'';</code>) in order to achieve an alternating background color between odd and even-numbered lists.

:; ''evenodd'' <span style="font-weight:normal;"><code>[swap, even, odd, off]</code></span>
:: If set to <code>swap</code>, then the automatic striping of even and odd rows is reversed. Normally, even rows get a light gray background for striping; when this parameter is used, the odd rows receive the gray striping instead of the even rows. Setting to <code>even</code> or <code>odd</code> sets all rows to have that striping color. Setting to <code>off</code> disables automatic row striping. NOTE: Due to system limitations, do '''not''' use a semi-colon to close this command.

==Setting the width of groups==
If multiple {{tl|Navbox subgroup}} templates are used inside of a parent {{tl|Navbox}}, it generally looks better if the width of the groups matches up. In order to do this, one must set the <code>groupwidth</code> parameter:

:<code>groupwidth = 10em</code>

An alternative way is to set the <code>groupstyle</code> parameters to contain the desired width, and the <code>liststyle</code> parameters to have width:auto (due to HTML/CSS reasons). For example, place the following code in each {{tl|Navbox subgroup}} to adjust the widths:
:<code>groupstyle = width:10em;</code>
:<code>liststyle = width:auto;</code>
*NOTE: For the <code>groupstyle</code> widths to work, you '''must''' set the <code>liststyle</code> width to "auto".
If you also use the <code>image</code> or <code>imageleft</code> parameters, then you will most likely also need to set their width manually using the <code>imagestyle</code> and <code>imageleftstyle</code> parameters.

==Example==
The following is an example of ''Navbox subgroup'' used within a ''Navbox'' template.

{{Navbox
| state = uncollapsed
| name = Navbox subgroup/doc
| title = Protected Areas of Colorado
| listclass = hlist
| group1 = National Park Service
| list1 = {{Navbox subgroup
| group1 = National Parks
| list1 =
*[[Black Canyon of the Gunnison National Park|Black Canyon of the Gunnison]]
*[[Great Sand Dunes National Park and Preserve|Great Sand Dunes]]
*[[Mesa Verde National Park|Mesa Verde]]
*[[Rocky Mountain National Park|Rocky Mountain]]
| group2 = National Monuments
| list2 =
*[[Colorado National Monument|Colorado]]
*[[Florissant Fossil Beds National Monument|Florissant Fossil Beds]]
*[[Hovenweep National Monument|Hovenweep]]
*[[Yucca House National Monument|Yucca House]]
| group3 = National Historic Sites
| list3 =
*[[Bent's Old Fort National Historic Site|Bent's Old Fort]]
*[[Sand Creek Massacre National Historic Site|Sand Creek Massacre]]
| group4 = National Recreation Area
| list4 =
*[[Curecanti National Recreation Area|Curecanti]]
}}
| group2 = National Forests
| list2 =
*[[Arapaho National Forest|Arapaho]]
*[[Grand Mesa National Forest|Grand Mesa]]
*[[Gunnison National Forest|Gunnison]]
*[[Pike National Forest|Pike]]
*[[Rio Grande National Forest|Rio Grande]]
*[[Roosevelt National Forest|Roosevelt]]
*[[Medicine Bow – Routt National Forest|Medicine Bow – Routt]]
*[[San Isabel National Forest|San Isabel]]
*[[San Juan National Forest|San Juan]]
*[[Uncompahgre National Forest|Uncompahgre]]
*[[White River National Forest|White River]]
}}

<pre style="overflow:scroll;">
{{Navbox
| state = uncollapsed
| name = Protected Areas of Colorado
| title = Protected Areas of Colorado
| listclass = hlist
| group1 = National Park Service
| list1 = {{Navbox subgroup
| group1 = National Parks
| list1 =
*[[Black Canyon of the Gunnison National Park|Black Canyon of the Gunnison]]
*[[Great Sand Dunes National Park and Preserve|Great Sand Dunes]]
*[[Mesa Verde National Park|Mesa Verde]]
*[[Rocky Mountain National Park|Rocky Mountain]]
| group2 = National Monuments
| list2 =
*[[Colorado National Monument|Colorado]]
*[[Florissant Fossil Beds National Monument|Florissant Fossil Beds]]
*[[Hovenweep National Monument|Hovenweep]]
*[[Yucca House National Monument|Yucca House]]
| group3 = National Historic Sites
| list3 =
*[[Bent's Old Fort National Historic Site|Bent's Old Fort]]
*[[Sand Creek Massacre National Historic Site|Sand Creek Massacre]]
| group4 = National Recreation Area
| list4 =
*[[Curecanti National Recreation Area|Curecanti]]
}}
| group2 = National Forests
| list2 =
*[[Arapaho National Forest|Arapaho]]
*[[Grand Mesa National Forest|Grand Mesa]]
*[[Gunnison National Forest|Gunnison]]
*[[Pike National Forest|Pike]]
*[[Rio Grande National Forest|Rio Grande]]
*[[Roosevelt National Forest|Roosevelt]]
*[[Medicine Bow - Routt National Forest|Medicine Bow - Routt]]
*[[San Isabel National Forest|San Isabel]]
*[[San Juan National Forest|San Juan]]
*[[Uncompahgre National Forest|Uncompahgre]]
*[[White River National Forest|White River]]
}}
</pre>

== See also ==
* {{tl|Navbox}} – Basic navbox
* {{tl|Navbox with columns}} – Allows columns instead of groups/lists
* {{tl|Navbox with collapsible groups}} – Another variation.
* {{strikethrough|[[Wikipedia:Line-break handling]] – The how-to guide about how to handle word wraps (line breaks) on Wikipedia, such as the wrapping of the link lists used in navboxes.}} Deprecated; use the <code>hlist</code> class.
* {{strikethrough|{{tl|Nowrap begin}} – The recommended format for adding bullets, pipes, or dashes between list items.}} Deprecated; use the <code>hlist</code> class.
* {{tl|Nobold}} – To display text at normal font-weight within a context where the default font-weight is bold, e.g. header cells in tables.

{{Navigation templates}}

<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
<!--Categories-->
[[Category:Navigational boxes| ]]
[[Category:Wikipedia metatemplates|{{PAGENAME}}]]
}}</includeonly>
Anonymous user

Navigation menu