1.0.0 • Published 6 years ago

react-file-explorer v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

react-file-explorer

Customizable and responsive file explorer component for React applications.

Getting Started

Installing

npm install --save react-file-explorer

Demo

React File Explorer

Properties

NameTypeDefaultRequiredDescription
dataarray[]yesThe array of objects representing files and folders to be listed. See dedicated paragraph here
showHistorybooleantruenoWhether or not to show navigable history
rootLabelstring'Home'noText to be shown as history root
onViewModeChangefunction()noCallback fired after the view mode changes
onSortModeChangefunction()noCallback fired after the sort mode changes
sortableByNamebooleantruenoWhether or not show 'Sort by name' option in menu
sortableBySizebooleantruenoWhether or not show 'Sort by size' option in menu
sortableByTypebooleantruenoWhether or not show 'Sort by type' option in menu
sortableByLastEditbooleantruenoWhether or not show 'Sort by last edit' option in menu
onRenamefunction(id, name)noCallback fired after a rename operation
onDeletefunction(id)noCallback fired after a delete operation

Data

Data is an array of objects representing the entire structure of files and folders.

NameTypeRequiredDescription
idstring or numberyesObject identifier, must be unique
namestringyesName to be shown
childrenarraynoWeather is a file or a folder

NOTE: An empty children array means that the object is an empty folder.

Style

You can add your custom style with both CSS and styled-components.

Those are the list of classes that you should override in order to customize the component.

File Explorer

.container

History

.history .history-level

Menu

.menu .first-level .nested-level

Item

.node .icon .filename .renaming-form .renaming-form-input

IMPORTANT: In order to override existing style, sometimes you need to use the !important keyword.