Template:Sidebar/doc

This template is a metatemplate for the creation of sidebar templates, i.e. boxes that are vertically-aligned navigation templates. Sidebars, like infoboxes, are usually positioned on the right-hand side of a page.

Sidebar with collapsible lists is a version of Sidebar that adds collapsibility to its sections, i.e. the means to show or hide sections by clicking links beside their headings.

Parameters
No parameters are mandatory. If navbar links are to function correctly (unless their appearance is suppressed; see the navbar parameter below), the parameter name needs to be set (to the name of the sidebar's page). (This does not apply if the Lua module that produces, Module:Sidebar, is being used directly.)

TemplateStyles
The TemplateStyles parameters templatestyles, child templatestyles, and grandchild templatestyles take the pagename of a TemplateStyles page and turn it into a TemplateStyles tag. The TemplateStyles tag is a much more powerful way to add styling to a sidebar.

Some rules of use:
 * 1) Always add a template-specific class in class so that the styles added to one sidebar will not "leak" into another sidebar. For example, Template:DYK tools has dyk-tools and the Template:DYK tools/styles.css page targets   for all of its added styling.
 * 2) Do not assume Template:Sidebar will continue to have a table structure (i.e., do not target   or any other table HTML in the TemplateStyles page). The table structure is soft-deprecated and will go away at some point in the future.

These tags are loaded in this order: Core templatestyles (Module:Sidebar/styles.css), templatestyles, child, and then grandchild, which can be used to 'cascade' the styles.


 * templatestyles
 * This parameter is intended for a template or module calling sidebar directly.


 * child templatestyles
 * This parameter is intended for a template or module which calls a sidebar with templatestyles.


 * grandchild templatestyles
 * This parameter is intended for a template or module which calls a sidebar with child templatestyles.

The canonical list of classes output with each kind of element of a sidebar (i.e. output for all contentn, or all cases of above) can be found in Module:Sidebar/configuration in the "class" table. The below is a non-authoritative but otherwise sufficient list for most generic styling:


 * The top-level sidebar class.
 * The top-level sidebar class.


 * The class associated with a outertitle.
 * The class associated with a outertitle.


 * The class associated with a topimage.
 * The class associated with a topimage.


 * The class associated with a topcaption.
 * The class associated with a topcaption.


 * The classes associated with a pretitle. Only one of these will be output per sidebar, depending on whether topimage is present.
 * The classes associated with a pretitle. Only one of these will be output per sidebar, depending on whether topimage is present.
 * The classes associated with a pretitle. Only one of these will be output per sidebar, depending on whether topimage is present.


 * The classes associated with a title. Only one of these will be output per sidebar, depending on whether pretitle is present.
 * The classes associated with a title. Only one of these will be output per sidebar, depending on whether pretitle is present.
 * The classes associated with a title. Only one of these will be output per sidebar, depending on whether pretitle is present.


 * The class associated with a image.
 * The class associated with a image.


 * The class associated with a caption.
 * The class associated with a caption.


 * The class associated with a above.
 * The class associated with a above.


 * The class associated with a headingn. Every heading will have this class.
 * The class associated with a headingn. Every heading will have this class.


 * The classes associated with contentn. Every content group will have one of these classes, depending on whether the specific content has a subgroup.
 * The classes associated with contentn. Every content group will have one of these classes, depending on whether the specific content has a subgroup.
 * The classes associated with contentn. Every content group will have one of these classes, depending on whether the specific content has a subgroup.


 * The class associated with a below.
 * The class associated with a below.


 * The class associated with a navbar.
 * The class associated with a navbar.

Example TemplateStyles parameter use
For an example of a sidebar which does not need to support children templates of its own (whether because it has no children or because it wants no children):

For an example of a sidebar which does have its own children and an example of one of the children (grandchild templates have a similar use):

Handling long links
Normalwraplink may be used to handle links that should wrap within the sidebar or otherwise need to be made to wrap, in order to prevent the sidebar from becoming too wide. Use, where longlinkname is the long link without its square brackets.

Use the true parameter to turn link wrapping off for the whole template.

Nesting
One sidebar template can be nested (embedded) into another one by using the child parameter. This feature can be used to create a modular sidebar, or to create more well-defined and logical sections.



Note in the examples above that the child sidebar is placed in a content field, not a heading field. Notice also that the section subheadings do not appear in bold if this is not explicitly specified. To obtain bold section headings, move the titles to the heading field, using



Deprecated parameters
The following parameters are deprecated in favor of TemplateStyles and templates/modules using them are categorized into Category:Sidebars with styles needing conversion. The category page has further conversion information.

A specific real conversion example is Template:DYK tools where the styles were moved to Template:DYK tools/styles.css.