Difference between revisions of "Template:Tree"
From StarMade Wiki
m (Added documentation.) |
DukeofRealms (talk | contribs) m (1 version) |
(No difference)
|
Revision as of 06:41, 21 May 2015
{{{1}}}
A template for tree-like structures, like directory or crafting trees.
Usage
Basic usage, creating only the root node. It is imparative that the root element is marked as such, by passing root as the second parameter.
{{tree|Label|root}}
- Label
Child elements can be passed in the children parameter.
{{tree|root|root|children= {{tree|child1, level1}} {{tree|child2, level1|children= {{tree|child1, level2}} {{tree|child2, level2|children={{tree|leaf}}}}}} {{tree|child3, level1|children={{tree|leaf}}}} }}
- root
- child1, level1
- child2, level1
- child1, level2
- child2, level2
- leaf
- child3, level1
- leaf
The template supports additional CSS classes which can be used to change the tree's shape. At the time of this writing, horizontal for horizontal children alignment, and single for nicer single leaf placement are supported.
{{tree|root|root|class=horizontal|children= {{tree|child1, level1}} {{tree|child2, level1|children= {{tree|child1, level2}} {{tree|child2, level2|class=horizontal single|children={{tree|leaf}}}}}} {{tree|child3, level1|class=single|children={{tree|leaf}}}} }}
- root
- child1, level1
- child2, level1
- child1, level2
- child2, level2
- leaf
- child3, level1
- leaf
Tooltips can be included with the description parameter, and small pieces of additional info using note. A special cursor will indicate if a tooltip is available on the respective element.
{{tree|root|root|description=An example tree.|class=horizontal|children= {{tree|child1|note=level1}} {{tree|child2|note=level1|children= {{tree|child1|note=level2}} {{tree|child2|note=level2|class=horizontal single|children={{tree|leaf}}}}}} {{tree|child3|note=level1|class=single|children={{tree|leaf}}}} }}
- root
- child1level1
- child2level1
- child1level2
- child2level2
- leaf
- child3level1
- leaf
The above documentation is transcluded from Template:Tree/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories and interwikis to the /doc subpage. Subpages of this template. |