Skip to content
Calm motion: animations on this site only fade, with no movement

File tree ​

Files and folders from a flat list of paths

Shows the files of a project as folders that open and close, for example the files of an episode. You give a plain list of paths, and the component makes the folders. For a tree of any data, use the tree, which this component uses.

Basic
  • ep41
    • audio

Selected: ep41/audio/final.mp3

  • paths is a list of paths such as audio/ep41/raw.wav. Each part before a / is a folder. A path that ends in / is an empty folder.
  • Folders come first, then files, each in order of name. Each file has an icon for its type: image, audio, video, text, settings, archive, or other.
  • v-model:selected is the path of the selected file or folder. The folders on the way to it start open. expanded opens every folder.
  • A click on a name emits select with the path, and with true for a folder.
  • The keys are the keys of the tree: the up and down arrows move, the right arrow opens a folder, the left arrow closes it, and Enter selects. label names the tree for screen readers.

Usage ​

ts
import { BlessFileTree } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
paths*string[]—the files, each as a path such as `audio/ep41/raw.wav`; a path that ends in `/` is an empty folder
expandedboolean—open every folder, not only the folders of the selected file
labelstring"Files"
selectedstring—the path of the selected file or folder

Events

NamePayloadDescription
select[path: string, folder: boolean]
update:selected[value: string | undefined]

Released under the MIT License. Character names and artwork belong to their owners.