通过 Sulfur.wiki 可快速访问本维基!
本WIKI编辑权限开放,欢迎收藏起来防止迷路,也希望有爱的小伙伴和我们一起编辑哟~

全站通知:

模板:Navbox/文档

来自火湖WIKI_BWIKI_哔哩哔哩
跳到导航 跳到搜索

This template is designed to set up navigational templates relatively quickly with one or more lists of links. We highly recommend using this template for standardizing navigational templates and ease of use, especially for mobile devices.

See the support wiki for more information, including installation steps and further examples.

Basic example

The following example demonstrates the core functionality of this template: the title text, one standard link group, and one link group that contains two sub-groups. The rows are striped for easier readability.

{{Navbox
| title = Items
| striped = even

| group1 = Consumables
| list1 =
* Health Potion
* Mana Potion

| group2 = Weapons

| group2.1 = Swords
| list2.1 =
* Wooden Sword
* Rusted Sword
* Steel Sword

| group2.2 = Bows
| list2.2 =
* Shortbow
* Crossbow
* Longbow
}}

Parameters

Main

The following parameters modify the navbox as a whole.

Parameter Description
title Text that appears at the top of the navbox.
state
collapsible
Controls if a navbox should be expanded or collapsed when the page loads. This only affects the whole navbox; if sections are used, they are treated differently.
  • expanded (default) - the navbox will start open and readers can collapse it.
  • collapsed - the navbox will start closed and readers can expand it.
  • off, no, or plain - the navbox will start open and cannot be collapsed.

Advanced users can modify this on a page-by-page basis; see § Snippets.

editlinks Controls if an edit icon should be displayed at the top-left of the navbox, making it easier for users to interact with the template itself.
  • unset (default) - displays the edit icon
  • off or no - hides the edit icon
above Text that appears above all list groups, directly below the title.
below Text that appears below all list groups, at the bottom of the navbox.
striped
evenodd
Controls if the navbox rows should have zebra striping on even or odd rows, making it easier for users to distinguish two rows apart from each other. If sections are used, each section resets the even/odd counter.
  • unset (default) - all rows have the same background
  • y, yes, on, striped, or even - even-numbered rows are highlighted
  • swap or odd - odd-numbered rows are highlighted

Sections

The following parameters define sections within the navbox with their own titles.

Parameter Description
headern Text that appears at the top of the section, where n is any positive integer. If the value is set to two or more - (e.g. --, -----, etc.) the new section will have no header bar and cannot be collapsed.

All groups and lists that are n or higher will appear in this section unless there is a higher headern later in the template. For example, if a navbox defines header1 and header4, the first section will include list1, list2, and list3 (and any of their sub-lists), while the second section will include all remaining lists starting at list4 and their sub-lists.

header_state
staten
header_state controls if all sections, by default, should be expanded or collapsed when the page loads.

staten overrides header_state for the specific section defined by headern (where n is a matching integer).

  • expanded (default) - the section will start open and readers can collapse it.
  • collapsed - the section will start closed and readers can expand it.
  • off or plain - the section will start open and cannot be collapsed.

Advanced users can modify these on a page-by-page basis; see § Snippets.

Both parameters have no effect on sections with headers set to two or more -, which are always expanded and cannot be collapsed.

List groups

The following parameters define the list groups.

Parameter Description
groupn Text label for a list, which appears on the left on desktop or at the top on mobile, where n is any positive integer.

This parameter is optional; if a listn does not have a matching groupn, the list will take the full width on desktop.

listn A wikitext list, where n is any positive integer.
groupn.x
groupn.x.y
etc.
Text label for sub-lists that appear under groupn, groupn.x, etc.
listn.x
listn.x.y
etc.
Wikitext sub-lists.

Styling

The following parameters add inline styling or your custom CSS classes to specific elements of the navbox.

To assist with text alignment, three default classes are available: align-left, align-center, and align-right.

In addition, two more default classes

Parameter Description
navbox_style
navbox_class
Modifies the parent navbox element; class can be used as a shorthand for navbox_class

Two default classes are available:

  • pill changes the links to pill-styled rather than dot-separated
  • pill-mobile only changes the links to pill-styled on mobile devices
title_style
title_class
Modifies the title bar
above_style
above_class
Modifies the above text row
below_style
below_class
Modifies the below text row
header_style
header_class
Modifies all section headers (not the title bar)
headern_style
headern_class
Modifies the specific section header n
sectionn_style
sectionn_class
Modifies the container holding the section defined by a matching headern
group_style
group_class
Modifies all base groups (groupn), but not any subgroups (groupn.x, etc.)
subgroup_style
subgroup_class
Modifies all subgroups at all levels (groupn.x, groupn.x.y, etc.)
groupA_style
groupA_class
Modifies the specific group A, where A is any n, n.x, n.x.y, etc.
list_style
list_class
Modifies all lists. Note, in this context, "list" refers to the container of a listn parameter, not a ul or ol element inside the parameter
listA_style
listA_class
Modifies the specific list A, where A is any n, n.x, n.x.y, etc.