Template:DropBox/doc

From Wikibooks, open books for an open world
Jump to: navigation, search

Documentation[edit]

A PrettyTextBox that can be shown or hidden, designed to act as a "box" in the style of separate information boxes as seen in textbooks (often labelled Box 1.1, etc.). This requires a title, which can be seen even when the contents of the box are hidden. Much of this functionality is copied from Template:Hidden. By default, the box is shown, unless the "hidden" parameter is set.

For extensive box contents which are relatively independent of the main text, consider using Template:TranscludeBox, which allows you to place the contents in a subpage of your book, and transclude it into the main page.

Parameters[edit]

This template displays the first parameter (the heading) with a [Show] link on the right. If the heading box or [Show] link is clicked by the user, the second parameter (the content) is also displayed. The following parameters are also available:

header
The heading for the box (e.g. Box 1.1). This can also be taken from the 1st unnamed parameter.
content
The content of the box. This can also be taken from the 2nd unnamed parameter.

Conventional css parameters[edit]

fw1
the font-weight for the heading
fw2
the font-weight for the body
bg
the background-color for the enclosing box
bg1
the background-color for the heading
bg2
the background-color for the body
ta1
the text-align for the heading
ta2
the text-align for the body
float
should the box be floated? (left, right, or none)
width
the width of the box, e.g. 33%
style
HTML/CSS affectionados only: any other css style arguments for the whole box

Special parameters[edit]

hidden
set this to any string (e.g. hidden=true) to have the box hidden by default
headType
allows you to set the box header to (say) "h4", which means it will be included in the table of contents. This is provided as an explicit parameter because if you just surround the title with header tags, e.g.
<h4>Box 1.1</h4>
Then the title will be displaced downwards by the show/hide button. See examples below.
preHead
allows you to specify stuff to place before the header. This is used, e.g. in Template:TranscludeBox.
dropClass
(default = collapsible) The class of the dropbox which determines the drop-down behaviour. Setting this to something other than collapsible will remove the drop-down behaviour of the box.
boxClass
(default = PrettyTextBox) The class of the dropbox which determines the style.

Examples[edit]

The simplest example

{{DropBox|Box 1.1|{{Lorem}}}}

renders as:

Box 1.1

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.


To hide by default, specify a value for "hidden"

{{DropBox|Box 1.2|{{Lorem}}|hidden=hidden}}

renders as:

Box 1.2

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.


Box 1.3

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

A more realistic example, setting the title to h4 which will place it in the TOC. This is produced by

{{DropBox|Box 1.3|{{Lorem}}|
headType=h4|
float=left|
bg=#999999|
width=33%}}

renders as seen on the left

Box 1.4

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Another similar layout, styled differently, and hidden by default. This is produced by

{{DropBox|Box 1.4|{{Lorem}}|
headType=h4|
float=right|
ta1=right|
bg=#BBBBFF|
bg1=#BBBBFF|
bg2=white|
hidden=hidden}}

renders as seen on the right

See also[edit]