HomePaymentsNo-codeDevelopersContribute
Safepay Home PageLive DashboardTest Dashboard

FileTree


The FileTree component creates a visual directory structure display, ideal for projects requiring a hierarchical view of files and folders with optional notes for each item.

Usage

FileTree Basic Usage
import React from 'react';
import { FileTree } from '~/ui/components/FileTree';

const files = [
  "index.js",
  ["src/App.js", "Main application file"],
  "src/components/Button.js",
  ["src/layouts/MainLayout.js", "Includes sidebar and navbar"]
];

export default function App() {
  return (
    <div>
      <h1>Project Files</h1>
      <FileTree files={files} />
    </div>
  );
}

Rendered Example

index.js
src
App.jsMain component file
styles.css

Props

NameTypeDefaultDescription
files(string | [string, string])[][]Array of file paths or tuples with path and note to generate the tree
classNamestringundefinedAdditional CSS classes applied to the container
styleobjectundefinedInline styles applied to the container
onClickfunctionundefinedHandler for click events on file or folder items
onMouseOverfunctionundefinedHandler for mouse over events on file or folder items