Difference between revisions of "Template:Navbox/doc"
Jump to navigation
Jump to search
old>Realpsojed (→Usage: removed subst:void and comment, as we don't have void template on this wiki.) |
m (4 revisions imported) |
||
(One intermediate revision by one other user not shown) | |||
Line 60: | Line 60: | ||
: <code>list<sub>n</sub></code> – text listing wikilinks using a [[wikipedia:Help:Lists|wikilist]] format. | : <code>list<sub>n</sub></code> – text listing wikilinks using a [[wikipedia:Help:Lists|wikilist]] format. | ||
: <code>below</code> – optional text to appear below the group/list section. | : <code>below</code> – optional text to appear below the group/list section. | ||
: <code>expand</code> – a custom parameter for Stoneshard Wiki. Allows you to expand Navboxes or Navbox subgroups on a per-page basis. | |||
== Parameter descriptions == | == Parameter descriptions == | ||
Line 82: | Line 83: | ||
:: If set to <code>plain</code>, the <span style="font-size: 88%;">V • T • E</span> links on the left side of the titlebar will not be displayed, and padding will be automatically used to keep the title centered. Use <code>off</code> to remove the <span style="font-size: 88%;">V • T • E</span> links, but not apply padding (this is for advanced use only; the "plain" option should suffice for most applications where a navbar is not desired). It is highly recommended that one not hide the navbar, in order to make it easier for users to edit the template, and to keep a standard style across pages. | :: If set to <code>plain</code>, the <span style="font-size: 88%;">V • T • E</span> links on the left side of the titlebar will not be displayed, and padding will be automatically used to keep the title centered. Use <code>off</code> to remove the <span style="font-size: 88%;">V • T • E</span> links, but not apply padding (this is for advanced use only; the "plain" option should suffice for most applications where a navbar is not desired). It is highly recommended that one not hide the navbar, in order to make it easier for users to edit the template, and to keep a standard style across pages. | ||
:; ''border'' | :; ''border'' | ||
::See section below on using navboxes within one another for examples and a more complete description. If set to child or subgroup, then the navbox can be used as a borderless child that fits snuggly in another navbox. The border is hidden and there is no padding on the sides of the table, so it fits into the list area of its parent navbox. If set to none, then the border is hidden and padding is removed, and the navbox may be used as a child of another container (do not use the none option inside of another navbox; similarly, only use the child/subgroup option inside of another navbox). If set to anything else (default), then a regular navbox is displayed with a 1px border. An alternate way to specify the border to be a subgroup style is like this (i.e. use the first unnamed parameter instead of the named border parameter): | |||
::<code><nowiki>{{Navbox|child | |||
... | |||
}}</nowiki></code> | |||
:; ''expand'' | |||
:: A custom parameter for Stoneshard Wiki. By default, when any <code>title</code> is specified and <code>state</code> isn't set to expanded/plain/off, the navbox automatically starts in collapsed state. The <code>expand</code> parameter allows you to select one specific navbox subgroup to start in expanded state. Expand parameter only works if you also specified the <code>title</code> and if <code>state</code> isn't set to expanded/plain/off. | |||
::Expected use is with multiple Navbox subgroups. The <code>expand</code> parameter is compared with the <code>title</code> parameter. If they match, the corresponding navbox subgroup starts expanded instead of collapsed. Used on {{tl|Navigation}}. | |||
{{doc/end}} | {{doc/end}} |
Latest revision as of 20:45, 21 November 2021
Documentation
[purge]
Usage
Please remove the parameters that are left blank. Don't change anything on the line | name = {{subst:PAGENAME}}. It will change itself when you save.
{{Navbox | name = {{subst:PAGENAME}} | title = | listclass = hlist | state = {{{state|}}} | above = | image = | group1 = | list1 = | group2 = | list2 = <!-- ... --> | group20 = | list20 = | below = }}
Parameter list
|
The navbox uses lowercase parameter names, as shown in the box (above). The required name and title will create a one-line box if other parameters are omitted.
Notice "group1" (etc.) is optional, as are sections named "above/below".
The basic and most common parameters are as follows (see below for the full list):
name
– the name of the template.title
– text in the title bar, such as: [[Widget stuff]].listclass
– a CSS class for the list cells, usuallyhlist
for horizontal lists. Alternatively, use bodyclass for the whole box.state
– controls when a navbox is expanded or collapsed.titlestyle
– a CSS style for the title-bar, such as:background: gray;
groupstyle
– a CSS style for the group-cells, such as:background: #eee;
above
– text to appear above the group/list section (could be a list of overall wikilinks).image
– an optional right-side image, coded as the whole image. Typically it is purely decorative, so it should be coded as[[File:XX.jpg|80px|link=|alt=]]
.imageleft
– an optional left-side image (code the same as the "image" parameter).groupn
– the left-side text before list-n (if group-n omitted, list-n starts at left of box).listn
– text listing wikilinks using a wikilist format.below
– optional text to appear below the group/list section.expand
– a custom parameter for Stoneshard Wiki. Allows you to expand Navboxes or Navbox subgroups on a per-page basis.
Parameter descriptions
The following is a complete list of parameters for using {{Navbox}}
. In most cases, the only required parameters are name
, title
, and list1
.
Setup parameters
- name
- The name of the template, which is needed for the "V • T • E" ("View • Talk • Edit") links to work properly on all pages where the template is used. You can enter
{{subst:PAGENAME}}
for this value as a shortcut. The name parameter is only mandatory if atitle
is specified, and theborder
parameter is not set, and thenavbar
parameter is not used to disable the navbar. - state [
autocollapse, collapsed, expanded, plain, off
]
- Defaults to
autocollapse
. A navbox withautocollapse
will start out collapsed if there are two or more tables on the same page that use other collapsible tables. Otherwise, the navbox will be expanded. For the technically minded, see MediaWiki:Hydradark.js. - If set to
collapsed
, the navbox will always start out in a collapsed state. - If set to
expanded
, the navbox will always start out in an expanded state. - If set to
plain
, the navbox will always be expanded with no [hide] link on the right, and the title will remain centered (by using padding to offset the V • T • E links). - If set to
off
, the navbox will always be expanded with no [hide] link on the right, but no padding will be used to keep the title centered. This is for advanced use only; the "plain" option should suffice for most applications where the [show]/[hide] button needs to be hidden.
- To show the box when standalone (non-included) but then auto-hide contents when in an article, put "expanded" inside
<noinclude|>
...</noinclude|>
tags. This setting will force the box visible when standalone (even when followed by other boxes), displaying "[hide]", but then it will auto-collapse the box when stacked inside an article:| state =
<noinclude|>
expanded</noinclude|>
- Often times, editors will want a default initial state for a navbox, which may be overridden in an article. Here is the trick to do this:
- In your intermediate template, create a parameter also named "state" as a pass-through like this:
| state = {{{state<includeonly>|your_desired_initial_state</includeonly>}}}
- The
<includeonly>
|
will make the template expanded when viewing the template page by itself.
- navbar
- If set to
plain
, the V • T • E links on the left side of the titlebar will not be displayed, and padding will be automatically used to keep the title centered. Useoff
to remove the V • T • E links, but not apply padding (this is for advanced use only; the "plain" option should suffice for most applications where a navbar is not desired). It is highly recommended that one not hide the navbar, in order to make it easier for users to edit the template, and to keep a standard style across pages. - border
- See section below on using navboxes within one another for examples and a more complete description. If set to child or subgroup, then the navbox can be used as a borderless child that fits snuggly in another navbox. The border is hidden and there is no padding on the sides of the table, so it fits into the list area of its parent navbox. If set to none, then the border is hidden and padding is removed, and the navbox may be used as a child of another container (do not use the none option inside of another navbox; similarly, only use the child/subgroup option inside of another navbox). If set to anything else (default), then a regular navbox is displayed with a 1px border. An alternate way to specify the border to be a subgroup style is like this (i.e. use the first unnamed parameter instead of the named border parameter):
{{Navbox|child ... }}
- expand
- A custom parameter for Stoneshard Wiki. By default, when any
title
is specified andstate
isn't set to expanded/plain/off, the navbox automatically starts in collapsed state. Theexpand
parameter allows you to select one specific navbox subgroup to start in expanded state. Expand parameter only works if you also specified thetitle
and ifstate
isn't set to expanded/plain/off.
- Expected use is with multiple Navbox subgroups. The
expand
parameter is compared with thetitle
parameter. If they match, the corresponding navbox subgroup starts expanded instead of collapsed. Used on{{Navigation}}
.
- Expected use is with multiple Navbox subgroups. The