Template:Dialog/collapsible
This is a dialog formatting template. It is meant for use on interactive dialog pages, and may involve interactions between wiki markup, html, and javascript. Please carefully test any edits before making them. |
Usage
Placing this template on a dialog page indicates — when viewing the dialog page via dialog action do verb view — that the first parameter should be displayed with a clickable toggle after it to make the second parameter visible or hidden below it. By default, the second parameter is initially hidden, and the output of this template when viewed directly rather than through the view verb is entirely hidden, even the first parameter.
Two optional parameters can alter these defaults: expanded
, and directly visible
. Non-blank parameter directly visible
makes the output visible without the view verb and, by default, makes the second parameter initially visible. Non-blank parameter expanded
overrides the defaults for visibility of the second parameter: if expanded=no
, the second parameter is initially hidden even if directly visible
is non-blank; and if expanded
has any other non-blank value, when viewed through the verb the second parameter is initially visible.
Internals
When viewing pages directly rather than through the view verb, collapsible boxes are typically handled by javascript run after page load; however, dialog actions are run long after other such javascript code, so that no other javascript operates on text viewed through the verb. This template provides basic collapsibility facilities, similar to those of template {{hidden}}.