Template:Simple navbox
Jump to navigation
Jump to search
| This template uses Lua: |
| This template uses TemplateStyles |
A simple navbox template used to construct other navigational templates. Use {{Navbox}} for anything more complicated.
Usage
Simple box with links
{{Simple navbox
|name = {{subst:PAGENAME}}
|title =
|image =
|list =
}}
Simple box with ordered links
{{Simple navbox
|name = {{subst:PAGENAME}}
|title =
|image =
|group1 =
|list1 =
|group2 =
|list2 =
<!-- ... -->
}}
{{Simple navbox
|name = {{subst:PAGENAME}}
|title =
|image =
|list =
{{Simple navbox
|title =
|list =
}}
{{Simple navbox
|title =
|group1 =
|list1 =
}}
<!-- ... -->
}}
Parameter list
All Parameters
name– the page name for the template, needed for the "v·t·e" section to work, omitting this will remove the "v·t·e" navbartitle– text in the title barcollapsible[a] – defaults toyes, set tonoif you want a non-collapsible navigation template.[b]state– set tocollapsed[c] to keep navbox closed by default, set toexpanded[d] to keep navbox open by default, set toplainif you want a non-collapsible navbox (same as setting collapsible to no).image– optional image, uses wiki syntax, as in:[[File:Example.png|50px]], will not show if|collapsible=noimageleft[e] – optional image, likeimageexcept it's on the left. You can use bothimageandimageleft, unlessimageouteris used.imagealign[f] – defaults to right.[g]imagevalign[h] – defaults to "center" (like middle in "valign"), set to "auto" to vertically align the image to top, accepts values for "align-self" CSS propertyimageouter[i] – likeimage, except it sits next to the header and content, does NOT acceptimage-alignorimage-valignparameters, MUST have|collapsible=noor|state=plain, overridesimageas well.imageouterright[j] – likeimageouterbut on the right.bodystyle– inline styling for the whole navbox container, such as:background:red; color:whitetitlestyleorheaderstyle– inline styling for the navbox header, such as:font-size:200%; color:green[k]navcontentstyle– inline styling for all navbox content.containerstyle– inline styling for navbox content, except{{{above}}}and{{{below}}}.contentstyle– inline styling for div containing all grouped list content, such as:color:gray; font-variant:small-capslist– text listing the links you want, NOT compatible withgroup1,list1
You can also use group1, list1 parameters to make an ordered list.
group1– name of group, goes up to 50list1– list of links for group, goes up to 50basestyle– sets a style for the title header, group names, and above and below sections, will be overriden by the respective parameters (titlestyle, groupstyle, abovestyle, etc.).[l]rowstyle– inline styling for the entire row containing the group and list.groupstyle– inline styling for each of the group rows, such asbackground: pink, border:1px solid blue[m][n]liststyle– inline styling for each of the list rows, such asbackground: pink, border:1px solid blue[o]oddgroupstyleandevengroupstyle– inline styling for every odd or even group, overridesgroupstyle[p]oddliststyleandevenliststyle– inline styling for every odd or even list, overridesliststylegroupnstyle– inline styling for the nth group row, with n being the number, likegroup4style, overridesoddgroupstyleandevengroupstylelistnstyle– inline styling for the nth list row, with n being the number, likelist4style, overridesoddliststyleandevenliststyleaboveorbelow– adds a group row above, or below, the group listabovestyle– inline styling for the "above" or "below" row, automatically applies to below section as well unless usingbelowstyle.belowstyle– inline styling for the "below" row, will overrideabovestyleif both are present.tablestyle– inline styling for table holding grouped lists
CSS trickery
WARNING: WILL BREAK STUFF IF YOU DO SOMETHING WRONG
You can specify a unique class for the template navbox by using bodyclass
bodyclass[q] – adds a CSS class to the navbox container, either existing ones (i.e. "hlist", "hlist toccolours") or a custom one, which can be used with either {{#CSS:}} or TemplateStyles to further customize the navbox templatelistclass– adds a CSS class to the list content (technically, within the class.simple-content).templatestyles– loads a CSS stylesheet: setting parameter toExample/styles.csswould load the stylesheet at Template:Example/styles.css
Semantic styling behavior
Using certain parameters, or certain inline styling within parameters, will add classes to elements of the Simple Navbox. This subtly changes the appearance of certain elements, so that users seeking to create a navbox with a certain style do not have to tinker with or add a dozen styling parameters. The footnotes get into more detail, but here is a brief overview for each trigger.
- Using
basestylewill add.simple-basestyleto the navbox class, modifying the look of groups and lists to be more "Wikipedian", notably, lists will have an alternating white and lightgrey background instead of lines. - Using
background:orbackground-color:property within the inline styling of either group or list parameters will slightly expand the padding of groups, lists and the main title header. - Using
color:property within the inline styling of group or title (also called header) parameters will make links within group names and the main title header inherit the color specified for those elements. - Setting either
|collapse = noor|state = plainand usingimageouterwill add.simple-outerclass to the navbox, which allow outer image navboxes to work.
Footnotes
- ↑ Alias:
collapse - ↑ Setting to
noremoves the NavFrame class from the navbox. - ↑ Also
closed - ↑ Also
open,uncollapsed - ↑ Alias:
image2 - ↑ Alias:
image-align - ↑ You can either use
imageand move it to the left, or just useimageleft. The way the code works, usingimageleftand setting this parameter toleftwill move it to the right. - ↑ Alias:
image-valign - ↑ Alias:
image-outer - ↑ Alias:
image-outer-right,imageouter2 - ↑ Using
colorstyling with this parameter adds the.simple-header-modifiedclass to the header, which makes the VTE and navtoggle links inherit the color of the header, which saves time and effort for 99.9% of usecases. If that's not something you want, you'll have to use the templatestyles method in the CSS trickery section. - ↑ Using this parameter adds the class
.simple-basestyle, which styles the navbox to more match the look of a standard Wikipedia Navbox. - ↑ Using
backgroundorbackground-colorstyling in any unnumbered group parameter (including odd and even, but not groupNstyle) adds the.simple-group-modifiedclass to the group-row table, which slightly modifies the padding of the groups and rows to make navboxes with colored backgrounds in group names look more organized. It shouldn't affect the look too much if that is not your intent, but that is still something to keep note of. If you actually wanted the changes in padding but don't want a colored background, you can just add "background:none" or something. - ↑ Using
colorstyling in any unnumbered group parameter (including odd and even, but not groupNstyle) adds the.simple-group-inheritclass, which makes all links in group names inherit the color of the group. If you don't want this behavior, you can style the group names with inline span or div tags. - ↑ Using
backgroundorbackground-colorstyling in any unnumbered list parameter (including odd and even, but not listNstyle) adds the.simple-list-modifiedclass to the group-row table, which removes the borders, which means you don't need to addborder:0toliststyleeverytime. If you wanted this behavior, you could add a border manually vialiststyle, and then addborder:0atlistNstyle, withNbeing the last value for the list in your navbox. - ↑ Unlike {{Navbox}}, no "oddstyle" or "evenstyle" exists.
- ↑ Alias:
class