Skip to main content
Kaleidoscope

FolderTree

Consistent, resource-agnostic folder-tree component

This component requires two MobX stores to be initialised to get started:

  • A FolderSelectionViewStore to manage selection state
  • A FolderTreeViewStore to manage the state of the folder tree; it takes as a second argument the selection store

Read only tree

A simple read-only tree with no ability to react to any interactions internally:

Editable example

Fully reactive tree

Using the selection store and a fully-populated view store, you can set up a folder tree that reacts to user interactions; note that:

  • parent-children relationships are set up by referring to the parent's ID from the child node (here node 3 has a parent of node 2)
  • selection is handled by linking up the onSelect prop from the FolderTree with the selection store's folder selection method
Editable example

Draggability

Moving folders is provided by enabling drag-and-drop functionality; enable this by providing onDragStart and onDropOverFolder props:

Editable example

Accessibility

  • This component has limited screenreader and keyboard-driven support; moving folders around is currently not possible via the keyboard