مواد ڏانھن هلو

سانچو:Navigation box

کليل ڄاڻ چيڪلي، وڪيپيڊيا مان
Documentation icon دستاويز سانچو[نمائش] [سنواريو] [تاريخچو] [تطهير]

سانچو:Template display

ڏسو vertically-aligned navigation لاءِ، Template:Sidebar.

This template allows a navigational template to be set up relatively quickly by supplying it with one or more lists of links. It comes equipped with default styles that should work for most navigational templates. Changing the default styles is possible, but not recommended. Using this template, or one of its "Navbox suite" sister templates, is highly recommended for standardization of navigational templates, and for ease of use.

سانچو:Navbox visibility

Please remove the parameters that are left blank.

{{Navigation box
| name       = {{subst:PAGENAME}}{{subst:void|Don't change anything on this line. It will change itself when you save.}}
| title      =
| listclass  = hlist
| state      = {{{state|}}}

| above      =
| image      =

| group1     =
| list1      =

| group2     =
| list2      =

| group3     =
| list3      =

<!-- ... -->

| below      =
}}

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, though child navboxes do not even require those to be set.

{{Navbox}} shares numerous common parameter names with its sister templates, {{Navbox with columns}} and {{Navbox with collapsible groups}}, for consistency and ease of use. Parameters marked with an asterisk (*) are common to all three master templates.

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 a title is specified, and the border parameter is not set, and the navbar parameter is not used to disable the navbar.
state* [autocollapse, collapsed, expanded, plain, off]
  • Defaults to autocollapse. A navbox with autocollapse 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:Common.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.
  • Example 1: {{Peso}} with autocollapse as the default initial state. Catalan peseta transcludes it and has only one navbox; thus, the peso navbox shows. Chilean peso has more than two navboxes; thus, the peso navbox collapses.
  • Example 2: {{Historical currencies of Hungary}} with expanded as the default initial state, as such:
| state = {{{state<includeonly>|expanded</includeonly>}}}
All transcluding articles show the content by default, unless there is a hypothetical article that specifies {{templatename|state=collapsed}} when transcluding.
  • Example 3: {{Tourism}} with collapsed as the default initial state, as such:
| state = {{{state<includeonly>|collapsed</includeonly>}}}
All transcluding articles will show the template as collapsed by default, but the template will still be uncollapsed whe

Parameter list

[سنواريو]

{{سانچو:PAGENAMETDOC | name = Navigation box/doc | state = uncollapsed | title = {{{title}}} | above = {{{above}}} | image = {{{image}}} | group1 = {{{group1}}} | list1 = {{{list1}}} | group2 = {{{group2}}} | list2 = {{{list2}}} | list3 = {{{list3}}} without {{{group3}}} | group4 = {{{group4}}} | list4 = {{{list4}}} | below = {{{below}}}
See alternate navbox formats under: Layout of table }}

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, usually hlist 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 extends to the left edge of the box, and defaults to text-align:center styling).
listn – text listing wikilinks using a wikilist format.
below – optional text to appear below the group/list section.


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 a title is specified, and the border parameter is not set, and the navbar parameter is not used to disable the navbar.
state* [autocollapse, collapsed, expanded, plain, off]
  • Defaults to autocollapse. A navbox with autocollapse 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:Common.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.
  • Example 1: {{Peso}} with autocollapse as the default initial state. Catalan peseta transcludes it and has only one navbox; thus, the peso navbox shows. Chilean peso has more than two navboxes; thus, the peso navbox collapses.
  • Example 2: {{Historical currencies of Hungary}} with expanded as the default initial state, as such:
| state = {{{state<includeonly>|expanded</includeonly>}}}
All transcluding articles show the content by default, unless there is a hypothetical article that specifies {{templatename|state=collapsed}} when transcluding.
  • Example 3: {{Tourism}} with collapsed as the default initial state, as such:
| state = {{{state<includeonly>|collapsed</includeonly>}}}
All transcluding articles will show the template as collapsed by default, but the template will still be uncollapsed when displayed on its own page.
  • The template {{Collapsible option}} explains how to use the state parameter. It can be added to a <noinclude>...</noinclude> section after the template definition or to the instructions on the {{documentation subpage}}.
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. Use off to remove the V • T

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 later section 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 snugly 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
...
}}
title*
Text that appears centered in the top row of the table. It is usually the template's topic, i.e. a succinct description of the body contents. This should be a single line, but if a second line is needed, use {{-}} to ensure proper centering. This parameter is technically not mandatory, but using {{Navbox}} is rather pointless without a title.
above*
A full-width cell displayed between the titlebar and first group/list, i.e. above the template's body (groups, lists and image). In a template without an image, above behaves in the same way as the list1 parameter without the group1 parameter.
groupn*
(i.e. group1, group2, etc.) If specified, text appears in a header cell displayed to the left of listn. If omitted, listn uses the full width of the table.
listn*
(i.e. list1, list2, etc.) The body of the template, usually a list of links. Format is inline, although the text can be entered on separate lines if the entire list is enclosed within <div> </div>. At least one list parameter is required; each additional list is displayed in a separate row of the table. Each listn may be preceded by a corresponding groupn parameter, if provided (see below).
Entries should be separated using a newline and an asterisk (*). If instead two asterisks are used, it provides nesting within the previous entry by enclosing the entry with brackets. Increasing the number of asterisks used increases the number of brackets around entries.
image*
An image to be displayed in a cell below the title and to the right of the body (the groups/lists). For the image to display properly, the list1 parameter must be specified. The image parameter accepts standard wikicode for displaying an image, e.g.:
[[File:XX.jpg|80px|link=|alt=]]
nb: including "|right" will produce the usual left margin to provide separation from the list items and zebra striping.
imageleft*
An image to be displayed in a cell below the title and to the left of the body (lists). For the image to display properly, the list1 parameter must be specified and no groups can be specified. It accepts the same sort of parameter that image accepts.
below*
A full-width cell displayed below the template's body (groups, lists and image). In a template without an image, below behaves in the same way as the template's final listn parameter without a groupn parameter. For an example of the below parameter in use, see this version of {{Lists of the provinces and territories of Canada}}.
Default styles
[سنواريو]

The style settings listed here are those that editors using the navbox change most often. The other more complex style settings were left out of this list to keep it simple. Most styles are set in MediaWiki:Common.css.

bodystyle = background: #fdfdfd; width: 100%; vertical-align: middle;
titlestyle = background: #ccccff; padding-left: 1em; padding-right: 1em; text-align: center;
abovestyle = background: #ddddff; padding-left: 1em; padding-right: 1em; text-align: center;
belowstyle = background: #ddddff; padding-left: 1em; padding-right: 1em; text-align: center;
groupstyle = background: #ddddff; padding-left: 1em; padding-right: 1em; text-align: right;
liststyle = background: transparent; text-align: left/center;
oddstyle = background: transparent;
evenstyle = background: #f7f7f7;

Since liststyle and oddstyle are transparent, odd lists have the color of the bodystyle, which defaults to #fdfdfd (white with a hint of gray). A list defaults to text-align: left; if it has a group, if not it defaults to text-align: center;. Since only bodystyle has a vertical-align all the others inherit its vertical-align: middle;.

Examples

[سنواريو]

No image

[سنواريو]
 {{Navigation box
 | name  = Navbox/doc
 | title = [[MSC Malaysia]]
 | listclass = hlist

 | group1 = Centre
 | list1  =
 * [[Cyberjaya]]

 | group2 = Area
 | list2  =
 * [[Klang Valley]]

 | group3 = Major landmarks
 | list3  =
 * [[Petronas Twin Towers]]
 * [[Kuala Lumpur Tower]]
 * [[Kuala Lumpur Sentral]]
 * [[Technology Park Malaysia]]
 * [[Putrajaya]]
 * [[Cyberjaya]]
 * [[Kuala Lumpur International Airport]]

 | group4 = Infrastructure
 | list4  =
 * [[Express Rail Link]]
 * [[KL-KLIA Dedicated Expressway]]

 | group5 = Prime applications
 | list5  =
 * [[E-Government]]
 * [[MyKad]]
 }}

{{سانچو:PAGENAMETDOC | name = Navigation box/doc | state = uncollapsed | title = MSC Malaysia | listclass = hlist | group1 = Centre | list1 =

| group2 = Area | list2 =

| group3 = Major landmarks | list3 =

| group4 = Infrastructure | list4 =

| group5 = Prime applications | list5 =

}}

With image, without groups

[سنواريو]
 {{Navigation box
 | name  = Navigation box/doc
 | title = [[MSC Malaysia]]
 | listclass = hlist
 | image = [[File:Flag of Malaysia.svg|80px|link=|alt=]]

 | list1 =
 * [[Petronas Twin Towers]]
 * [[Kuala Lumpur Tower]]
 * [[Kuala Lumpur Sentral]]
 * [[Technology Park Malaysia]]
 * [[Putrajaya]]
 * [[Cyberjaya]]
 * [[Kuala Lumpur International Airport]]
 }}

{{سانچو:PAGENAMETDOC | name = Navigation box/doc | title = MSC Malaysia | listclass = hlist | image = | list1 =

}}

With two images, without groups, multiple lists

[سنواريو]
 {{Navigation box
 | name  = Navigation box/doc
 | title = [[MSC Malaysia]]
 | listclass = hlist
 | image = [[File:Flag of Malaysia.svg|80px|link=|alt=]]
 | imageleft = [[File:Flag of Malaysia.svg|80px]]

 | list1 =
 * [[Petronas Twin Towers]]
 * [[Kuala Lumpur Tower]]
 * [[Kuala Lumpur Sentral]]

 | list2 =
 * [[Express Rail Link]]
 * [[KL-KLIA Dedicated Expressway]]

 | list3 =
 * [[E-Government]]
 * [[MyKad]]

 | list4 =
 * [[Klang Valley]]
 }}

{{سانچو:PAGENAMETDOC | name = Navigation box/doc | title = MSC Malaysia | listclass = hlist | image = | imageleft = | list1 =

| list2 =

| list3 =

| list4 =

}}

With image, groups, above, below

[سنواريو]
 {{Navigation box
 | name  = Navigation box/doc
 | title = [[MSC Malaysia]]
 | listclass = hlist
 | above = Above text goes here
 | image = [[File:Flag of Malaysia.svg|80px|link=|alt=]]

 | group1 = Centre
 | list1  =
 * [[Cyberjaya]]

 | group2 = Area
 | list2  =
 * [[Klang Valley]]

 | group3 = Major landmarks
 | list3  =
 * [[Petronas Twin Towers]]
 * [[Kuala Lumpur Tower]]
 * [[Kuala Lumpur Sentral]]
 * [[Technology Park Malaysia]]
 * [[Putrajaya]]
 * [[Cyberjaya]]

 | group4 = Infrastructure
 | list4  =
 * [[Express Rail Link]]
 * [[KL-KLIA Dedicated Expressway]]

 | group5 = Prime applications
 | list5  =
 * [[E-Government]]
 * [[MyKad]]

 | below  = Below text goes here
 }}

Examples

[سنواريو]

No image

[سنواريو]
 {{Navigation box
 | name  = Navigation box/doc
 | title = [[MSC Malaysia]]
 | listclass = hlist

 | group1 = Centre
 | list1  =
 * [[Cyberjaya]]

 | group2 = Area
 | list2  =
 * [[Klang Valley]]

 | group3 = Major landmarks
 | list3  =
 * [[Petronas Twin Towers]]
 * [[Kuala Lumpur Tower]]
 * [[Kuala Lumpur Sentral]]
 * [[Technology Park Malaysia]]
 * [[Putrajaya]]
 * [[Cyberjaya]]
 * [[Kuala Lumpur International Airport]]

 | group4 = Infrastructure
 | list4  =
 * [[Express Rail Link]]
 * [[KL-KLIA Dedicated Expressway]]

 | group5 = Prime applications
 | list5  =
 * [[E-Government]]
 * [[MyKad]]
 }}

{{سانچو:PAGENAMETDOC | name = Navigation box/doc | state = uncollapsed | title = MSC Malaysia | listclass = hlist | group1 = Centre | list1 =

| group2 = Area | list2 =

| group3 = Major landmarks | list3 =

| group4 = Infrastructure | list4 =

| group5 = Prime applications | list5 =

}}

With image, without groups

[سنواريو]
 {{Navigation box
 | name  = Navigation box/doc
 | title = [[MSC Malaysia]]
 | listclass = hlist
 | image = [[File:Flag of Malaysia.svg|80px|link=|alt=]]

 | list1 =
 * [[Petronas Twin Towers]]
 * [[Kuala Lumpur Tower]]
 * [[Kuala Lumpur Sentral]]
 * [[Technology Park Malaysia]]
 * [[Putrajaya]]
 * [[Cyberjaya]]
 * [[Kuala Lumpur International Airport]]
 }}

{{سانچو:PAGENAMETDOC | name = Navigation box/doc | title = MSC Malaysia | listclass = hlist | image = | list1 =

}}

With two images, without groups, multiple lists

[سنواريو]
 {{Navigation box
 | name  = Navigation box/doc
 | title = [[MSC Malaysia]]
 | listclass = hlist
 | image = [[File:Flag of Malaysia.svg|80px|link=|alt=]]
 | imageleft = [[File:Flag of Malaysia.svg|80px]]

 | list1 =
 * [[Petronas Twin Towers]]
 * [[Kuala Lumpur Tower]]
 * [[Kuala Lumpur Sentral]]

 | list2 =
 * [[Express Rail Link]]
 * [[KL-KLIA Dedicated Expressway]]

 | list3 =
 * [[E-Government]]
 * [[MyKad]]

 | list4 =
 * [[Klang Valley]]
 }}

{{سانچو:PAGENAMETDOC | name = Navigation box/doc | title = MSC Malaysia | listclass = hlist | image = | imageleft = | list1 =

| list2 =

| list3 =

| list4 =

}}

With image, groups, above, below

[سنواريو]
 {{Navigation box
 | name  = Navigation box/doc
 | title = [[MSC Malaysia]]
 | listclass = hlist
 | above = Above text goes here
 | image = [[File:Flag of Malaysia.svg|80px|link=|alt=]]

 | group1 = Centre
 | list1  =
 * [[Cyberjaya]]

 | group2 = Area
 | list2  =
 * [[Klang Valley]]

 | group3 = Major landmarks
 | list3  =
 * [[Petronas Twin Towers]]
 * [[Kuala Lumpur Tower]]
 * [[Kuala Lumpur Sentral]]
 * [[Technology Park Malaysia]]
 * [[Putrajaya]]
 * [[Cyberjaya]]

 | group4 = Infrastructure
 | list4  =
 * [[Express Rail Link]]
 * [[KL-KLIA Dedicated Expressway]]

 | group5 = Prime applications
 | list5  =
 * [[E-Government]]
 * [[MyKad]]

 | below  = Below text goes here
 }}

With image, groups, above, below

[سنواريو]
 {{Navigation box
 | name  = Navigation box/doc
 | title = [[MSC Malaysia]]
 | listclass = hlist
 | above = Above text goes here
 | image = [[File:Flag of Malaysia.svg|80px|link=|alt=]]

 | group1 = Centre
 | list1  =
 * [[Cyberjaya]]

 | group2 = Area
 | list2  =
 * [[Klang Valley]]

 | group3 = Major landmarks
 | list3  =
 * [[Petronas Twin Towers]]
 * [[Kuala Lumpur Tower]]
 * [[Kuala Lumpur Sentral]]
 * [[Technology Park Malaysia]]
 * [[Putrajaya]]
 * [[Cyberjaya]]

 | group4 = Infrastructure
 | list4  =
 * [[Express Rail Link]]
 * [[KL-KLIA Dedicated Expressway]]

 | group5 = Prime applications
 | list5  =
 * [[E-Government]]
 * [[MyKad]]

 | below  = Below text goes here
 }}

{{سانچو:PAGENAMETDOC | name = Navigation box/doc | title = MSC Malaysia | listclass = hlist | above = Above text goes here | image = | group1 = Centre | list1 =

| group2 = Area | list2 =

| group3 = Major landmarks | list3 =

| group4 = Infrastructure | list4 =

| group5 = Prime applications | list5 =

| below = Below text goes here }}

See also

[سنواريو]
  • {{Navboxes}} — groups several navigation boxes together.
  • {{Navbar}} — Used for the navigation links in navbox.
  • {{Nobold}} — To display text at normal font-weight within a context where the default font-weight is bold, e.g. header cells in tables.
  • {{Sidebar}} — Vertically-aligned navigation templates.
  • Template:Navbox/testcases — For additional examples of template code.
  • 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.
  • Wikipedia:Template documentation — Guideline to creating the accompanying documentation
  • {{Nowrap begin}}, {{·}} and {{}} are deprecated in favor of the hlist class for formatting lists. See Flatlist for a technical explanation of how hlist works.
Navigation template comparison
collapsible Header color Image Groups Style (body)
parameter/s
Examples
{{Navbox}} collapsible navbox Left/right of body ھا ھا {{USCongress}}, |1|جيڪڏهن!}}|Apollo program:ﺳﺎﻧﭽو ]]}}
{{Navbox with columns}} collapsible navbox Left/right of columns نہ ھا 1|جيڪڏهن!}}|Current U.S. Senators:ﺳﺎﻧﭽو ]]}}, {{UK subdivisions}}
The background color for the header or title is inherited from the class listed below. The templates have titlestyle parameters that can be used to override the default.
Collapsible attributes
Type CSS classes Collapses when Custom
initial state
Nesting Default
header color
Font size
Collapsible tables collapsible 2 or more autocollapse on page ھا ھا #ccf 90%