react-filetree

1.2.4 • Public • Published

react-filetree

npm npm

Currently work in progress...more functionalities and customizations will arrive soon!

Getting Started

Installing

npm install --save react-filetree

Usage

Example

data.js

const action = (event) => {
    console.log('action', event)
}

const data = [
    {
        id: '0',
        name: 'Folder 1',
        children: [
            {
                id: '1',
                name: 'File 1 in Folder 1',
                action,
            }, {
                id: '2',
                name: 'File 2 in Folder 2',
                action,
            },
        ],
    }, {
        id: '3',
        name: 'Empty Folder',
        children: [],
    }, {
        id: '4',
        name: 'Folder 2',
        children: [
            {
                id: '5',
                name: 'File 1 in Folder 2',
            }, {
                id: '6',
                name: 'File 2 in Folder 2',
                action,
            }, {
                id: '7',
                name: 'File 3 in Folder 2',
            },
        ],
    }, {
        id: '8',
        name: 'File in root',
    },
];

export default data;

index.html

<!doctype html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>React File Tree</title>
  </head>
  <body>
    <div id="root"></div>
  </body>
</html>

index.js

import React from 'react';
import ReactDOM from 'react-dom';
import { FileTree } from 'react-filetree';

import data from './data.js';

ReactDOM.render(
    <FileTree 
        data={data}
    />,
  	document.getElementById('root'),
);

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.2.42latest

Version History

VersionDownloads (Last 7 Days)Published
1.2.42
1.2.31
1.2.22
1.2.11
1.2.01
1.1.13
1.1.01
1.0.12
1.0.01
0.0.12

Package Sidebar

Install

npm i react-filetree

Weekly Downloads

16

Version

1.2.4

License

MIT

Last publish

Collaborators

  • one89