Template:Navbox/doc: Difference between revisions

no edit summary
mNo edit summary
No edit summary
 
Line 1: Line 1:
{{wikipedia}}
{{wikipedia|Template:Navbox/doc}}
This template allows a [[Wikipedia:Navigation templates|navigational template]] to be set up relatively quickly by supplying it one or more lists of links.  It comes equipped with default styles that should work for most navigational templates. Changing the default styles is not recommended, but is possible.  Using this template, or one of its "Navbox suite" sister templates, is highly recommended for standardization of navigational templates, and for ease of use.
This template allows a [[Wikipedia:Navigation templates|navigational template]] to be set up relatively quickly by supplying it one or more lists of links.  It comes equipped with default styles that should work for most navigational templates. Changing the default styles is not recommended, but is possible.  Using this template, or one of its "Navbox suite" sister templates, is highly recommended for standardization of navigational templates, and for ease of use.


Line 68: Line 68:
The following is a complete list of parameters for using {{tl|Navbox}}.  In most cases, the only required parameters are <code>name</code>, <code>title</code>, and <code>list1</code>, though [[Template:Navbox/doc#Child navboxes|child navboxes]] do not even require those to be set.
The following is a complete list of parameters for using {{tl|Navbox}}.  In most cases, the only required parameters are <code>name</code>, <code>title</code>, and <code>list1</code>, though [[Template:Navbox/doc#Child navboxes|child navboxes]] do not even require those to be set.


{{tl|Navbox}} shares numerous common parameter names as its sister templates {{tl|Navbox with columns}} and {{tl|Navbox with collapsible groups}} for consistency and ease of use.  Parameters marked with an asterisk <nowiki>*</nowiki> are common to all three master templates.
{{tl|Navbox}} shares numerous common parameter names as its sister templates <nowiki>{{</nowiki>[[wp:Template:Navbox with columns|Navbox with columns]]<nowiki>}}</nowiki> and <nowiki>{{</nowiki>[[wp:Template:Navbox with collapsible groups|Navbox with collapsible groups]]<nowiki>}}</nowiki> for consistency and ease of use.  Parameters marked with an asterisk <nowiki>*</nowiki> are common to all three master templates.


=== Setup parameters ===
=== Setup parameters ===
Line 90: Line 90:
:*The <nowiki><includeonly>|</nowiki> will make the template expanded when viewing the template page by itself.
:*The <nowiki><includeonly>|</nowiki> will make the template expanded when viewing the template page by itself.


::*Example: {{tl|peso}} with autocollapse as the default initial state. [[Bolivian peso]] transcludes it and has only one navbox. So the peso navbox shows. [[Chilean peso]] has two navboxes. So the peso navbox collapses.
::*Example: <nowiki>{{</nowiki>[[wp:Template:peso|peso]]<nowiki>}}</nowiki> with autocollapse as the default initial state. [[wp:Bolivian peso|Bolivian peso]] transcludes it and has only one navbox. So the peso navbox shows. [[wp:Chilean peso|Chilean peso]] has two navboxes. So the peso navbox collapses.


::*Example: {{tl|Historical currencies of Hungary}} with expanded as the default initial state. All transcluding articles shows the content by default, unless there were an hypothetical article that specifies state = collapsed when transcluding.
::*Example: <nowiki>{{</nowiki>[[wp:Template:Historical currencies of Hungary|Historical currencies of Hungary]]<nowiki>}}</nowiki> with expanded as the default initial state. All transcluding articles shows the content by default, unless there were an hypothetical article that specifies state = collapsed when transcluding.


:; ''navbar''<nowiki>*</nowiki>
:; ''navbar''<nowiki>*</nowiki>
Line 100: Line 100:
:: ''See section below on using navboxes within one another for examples and a more complete description.''  If set to <code>child</code> or <code>subgroup</code>, 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 <code>none</code>, 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 <code>none</code> option inside of another navbox; similarly, only use the <code>child</code>/<code>subgroup</code> 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):
:: ''See section below on using navboxes within one another for examples and a more complete description.''  If set to <code>child</code> or <code>subgroup</code>, 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 <code>none</code>, 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 <code>none</code> option inside of another navbox; similarly, only use the <code>child</code>/<code>subgroup</code> 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>
:::<code><nowiki>{{Navbox|child</nowiki></code>
::::<code>...
::::<code>...</code>
:::<code><nowiki>}}</nowiki></code>
:::<code><nowiki>}}</nowiki></code>


Line 125: Line 125:


:; ''below''<nowiki>*</nowiki>
:; ''below''<nowiki>*</nowiki>
:: 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 ''list<sub>n</sub>'' parameter without a ''group<sub>n</sub>'' parameter. For an example of the ''below'' parameter in use, see {{tl|Lists of the provinces and territories of Canada}}.
:: 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 ''list<sub>n</sub>'' parameter without a ''group<sub>n</sub>'' parameter. For an example of the ''below'' parameter in use, see <nowiki>{{</nowiki>[[wp:Template:Lists of the provinces and territories of Canada|Lists of the provinces and territories of Canada]]<nowiki>}}</nowiki>.


=== Style parameters ===
=== Style parameters ===
Line 131: Line 131:


:; ''style''<nowiki>*</nowiki>
:; ''style''<nowiki>*</nowiki>
:: Specifies [[Cascading Style Sheets|CSS]] styles to apply to the template body.  The parameter ''bodystyle'' also does the example same thing and can be used in place of this ''style'' parameter.  This option should be used sparingly as it can lead to visual inconsistencies. Examples:
:: Specifies [[wp:Cascading Style Sheets|CSS]] styles to apply to the template body.  The parameter ''bodystyle'' also does the example same thing and can be used in place of this ''style'' parameter.  This option should be used sparingly as it can lead to visual inconsistencies. Examples:
::: <code>style = background:#''nnnnnn'';</code>
::: <code>style = background:#''nnnnnn'';</code>
::: <code>style = width:''N''&nbsp;[em/%/px or width:auto];</code>
::: <code>style = width:''N''&nbsp;[em/%/px or width:auto];</code>
Line 142: Line 142:


:; ''titlestyle''<nowiki>*</nowiki>
:; ''titlestyle''<nowiki>*</nowiki>
:: [[Cascading Style Sheets|CSS]] styles to apply to ''title'', most often the titlebar's background color:
:: [[wp:Cascading Style Sheets|CSS]] styles to apply to ''title'', most often the titlebar's background color:
::: <code><nowiki>titlestyle = background:</nowiki>''#nnnnnn'';</code>
::: <code><nowiki>titlestyle = background:</nowiki>''#nnnnnn'';</code>
::: <code><nowiki>titlestyle = background:</nowiki>''name'';</code>
::: <code><nowiki>titlestyle = background:</nowiki>''name'';</code>
12,236

edits