Tree View
Folders, files and permission trees with search, tri-state checkboxes and full keyboard support. No library.
File Explorer
Click a folder to open it, a file to see its details. Type to filter.
-
src
-
app
-
layouts
-
sidebar.js
-
header.js
-
-
plugins
-
datepicker.js
-
tree.js
-
mask.js
-
-
-
css
-
styles.css
-
theme.css
-
utilities.css
-
-
-
theme
-
views
-
base.njk
-
app.njk
-
-
data
-
index.js
-
menu.js
-
-
pages.json
-
-
logo.svg
-
README.md
-
package.json
{% from "macros/tree.njk" import tree %}
{{ tree(themeData.tree.files, { id: 'files', label: 'Project files' }) }}
<!-- Search + expand / collapse, pointed at the tree id -->
<input data-tree-search="files">
<button data-tree-action="expand" data-tree-target="files">Expand all</button>
// Node: { id, label, icon?, tone?, open?, meta?, children? }
document.getElementById('files').addEventListener('tree:select', (e) => console.log(e.detail.id));
Role Permissions
Tick a group to tick everything inside it. Parents show a dash when only some are on.
-
Orders
-
View orders
-
Edit & refund
-
Export CSV
-
-
Catalogue
-
Products
-
View
-
Create & edit
-
Delete
-
-
Stock
-
View levels
-
Adjust
-
-
-
Content
-
Posts
-
Pages
-
Media library
-
-
Settings
-
Billing
-
Team & roles
-
{{ tree(themeData.tree.permissions, { id: 'perms', label: 'Permissions', checkbox: true }) }}
// Set checked: true on leaves; parents are worked out (all / some / none).
perms.addEventListener('tree:change', (e) => save(e.detail.checked)); // ['p-orders-view', …]
KZTree.checked(perms); // same list, any time
Keyboard & Screen Readers
Follows the WAI-ARIA tree pattern: one Tab stop per tree, arrows to move. Click a tree, then try it.