Organize information effectively with creating tree-shaped hierarchical list structures.
The Tree component in JTB_MD is a powerful tool for creating hierarchical list structures. It allows you to organize and display information in a tree-shaped format, making it ideal for scenarios like file directories or any hierarchical data representation.
With customizable options, trees provide practical solutions for managing complex data relationships. Whether showcasing organizational hierarchies or categorizing content, they offer a clear and intuitive way to structure information within your web projects.
To implement a tree in your projects, simply create a <ul>
or <ol>
element and apply the .jtbTree
class to it. This will be your main container for sub-elements.
Once your main container is created, you are free to add items using <li>
tags.
<!-- Example tree -->
<ul class='jtbTree'>Main container
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
To create nested trees, simply add another tree element within the first-level item.
<!-- Nested tree -->
<ul class='jtbTree'>Main container
<li>
<ul class='jtbTree'>Nested container
<li>Item 1.1</li>
<li>Item 1.2</li>
<li>Item 1.3</li>
</ul>
</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
To have trees expanded at the page load stage, simply apply the .show
class to them.
<!-- Expanded tree -->
<ul class='jtbTree show'>
...
</ul>
To enhance visual appeal, you have the flexibility to use any content within your tree containers and items. Simply add them as needed, the library does the rest.
<!-- Additional content -->
<ul class='jtbTree show'><i class='...'></i> Main folder
<li>
<ul class='jtbTree show'><i class='...'></i> Sub folder 1
<li><i class='...'></i> File 1</li>
<li><i class='...'></i> File 2</li>
<li><i class='...'></i> File 3</li>
</ul>
</li>
<li><i class='...'></i> File 4</li>
<li><i class='...'></i> File 5</li>
</ul>
To create a tree element without lines, apply the .jtbTree-noline
class to your .jtbTree
element.
<!-- Tree with no lines -->
<ul class='jtbTree jtbTree-noline'>
...
</ul>
To disable an item from expanding, you can add .disabled
class into it.
<!-- Disabled tree -->
<ul class='jtbTree disabled'>
...
<li class='disabled'>Disabled item</li>
</ul>
Copyright © 2024 JTBLabs - All rights reserved.