AppFileTree
A file tree (APG Tree View): nested folders and files with one Tab stop. Up and Down move through the visible items, Right opens a folder or steps into it, Left closes it or steps out to the parent, Home and End jump to the ends, typing jumps to the next item starting with the typed text, and * opens every folder beside the current one. Enter or a click picks an item and opens or closes a folder; Space only picks. Folders can load their children the first time they open.
Install: pnpm add-component AppFileTree
Basic usage
Folders show a folder icon that opens with them, files a document; a node can bring its own icon. Emits select(node), toggle(node, open) and, when load rejects, error(node, error).
Lazy folders
Give folders an empty children array and a load function: the first open shows a spinner (aria-busy on the item) and the returned children appear when it resolves. A folder that loads nothing says so.
API
items(FileTreeNode[]): Nested nodes { id, label, icon?, children? }. A node with children (even an empty array) is a folder.selected(string | null): The picked node id (v-model:selected).expanded(string[]): Ids of the open folders (v-model:expanded). Works without a binding.label(string): Names the tree. Required unless aria-labelledby points at a visible heading.load((node) => Promise<FileTreeNode[] | void>): Called the first time a folder with empty children opens. Return its children, or fill node.children yourself.emptyLabel(string): Shown in an open folder with nothing in it, and read as part of its name.