0.1.4 • Published 4 years ago

react-forest v0.1.4

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

react-forest

A simple React file structure viewer.

Usage:

Simply use the tag <Forest /> in a React app.

The Forest component requires a data parameter, which can either be an array of folders and files or a dictionary signifying a root folder with child elements.

All folders must have a boolean property titled folder and have it set to true. Non-empty folders should also have a property children, which should be an array of files. Files should not have a folder property, but are required to have a url property containing a link to the file. All files and folders must have a name property.

Dict Example:

{
    "name": "TestRootFolder",
    "folder": true,
    "children": [
        {
            "name": "TestFile",
            "url": "https://example.com/TestFile"
        },
        {
            "name": "TestSubFolder1",
            "folder": true,
            "children": [
                // etc
            ]
        }
    ]
}

Array Example:

[
    {
        "name": "TestFile",
        "url": "https://example.com/TestFile"
    },
    {
        "name": "TestFolder1",
        "folder": true,
        "children": [
            {
                "name": "TestFile2",
                "url": "https://example.com/TestFile2"
            }
        ]
    },
    {
        "name": "TestFolder2",
        "folder": true,
        "children": [
            // empty
        ]
    }
]
0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago