Package Exports
- react-animated-tree
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-animated-tree) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
npm install react-animated-tree
A simple, configurable tree view control for React.
Demo: https://codesandbox.io/embed/rrw7mrknyp
content
, Name of the node, can be strings or React-componentstype
, optional: description, will be presented a little smalleropen
, optional: open statecanHide
, optional: when set true will display a little eye iconvisible
, optional: when canHide is true, visible controls the visible-stateonClick
, optional: click events on the eyespringConfig
, optional: react-spring animation config
import Tree from 'react-animated-tree'
<Tree content="Apple" type="Fruit" open canHide visible onClick={console.log}>
<Tree content="Contents">
<Tree content="Seeds" />
<Tree>
<Tree>
You can create your own effects by passing a react-spring config. Everything that Spring
can take in is allowed (from, to, immediate, config, onRest, etc.). The config below is the default (items fade in while moving in 20px from the right). You can go wild here by rotating, flipping, whatever you feel like.
import Tree from 'react-animated-tree'
config = open => ({
from: { height: 0, opacity: 0, transform: 'translate3d(20px,0,0)' },
to: {
height: open ? 'auto' : 0,
opacity: open ? 1 : 0,
transform: open ? 'translate3d(0,0,0)' : 'translate3d(20px,0,0)',
},
})
const SpecialTree = props => <Tree {...props} springConfig={config} />
<SpecialTree content="Name">
<SpecialTree content="Subtree">
<SpecialTree content="Sub-sub-tree" />
<SpecialTree>
<SpecialTree>