Template:Tree/doc

From StarMade Wiki

< Template:Tree

Revision as of 17:02, 8 July 2016 by DukeofRealms (talk | contribs) (2 revisions imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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