title
is the primary label for the node.
subtitle
is a secondary label for the node.
expanded
shows children of the node if true, or hides them if false. Defaults to false.
children
is an array of child nodes belonging to the node.
Example: [{title: 'main', subtitle: 'sub'}, { title: 'value2', expanded: true, children: [{ title: 'value3') }] }]
( treeData: object[] ): void
path
array passed in callbacks. With a setting of getNodeKey={({ node }) => node.id}
, for example, in callbacks this will let you easily determine that the node with an id
of 35
is (or has just become) a child of the node with an id
of 12
, which is a child of ... and so on. It uses defaultGetNodeKey
by default, which returns the index in the tree (omitting hidden nodes).
({ node: object, treeIndex: number }): string or number
buttons
key, or additional style
/ className
settings.
({ node: object, path: number[] or string[], treeIndex: number, lowerSiblingCounts: number[], isSearchMatch: bool, isSearchFocus: bool }): object
({ treeData: object[], node: object, nextParentNode: object, prevPath: number[] or string[], prevTreeIndex: number, nextPath: number[] or string[], nextTreeIndex: number }): void
({ treeData: object[], node: object, expanded: bool, path: number[] or string[] }): void
({ isDragging: bool, draggedNode: object }): void
'rtl'
Defaults to 'ltr'
. canDrag func or bool Return false from callback to prevent node from dragging, by hiding the drag handle. Set prop to false
to disable dragging on all nodes. Defaults to true
.
({ node: object, path: number[] or string[], treeIndex: number, lowerSiblingCounts: number[], isSearchMatch: bool, isSearchFocus: bool }): bool
({ node: object, prevPath: number[] or string[], prevParent: object, prevTreeIndex: number, nextPath: number[] or string[], nextParent: object, nextTreeIndex: number }): bool
canDrop
condition. Default is set to a function that returns true
. Functions should be of type (node): bool
. theme object Set an all-in-one packaged appearance for the tree. See the Themes section for more information. searchMethod func The method used to search nodes. Defaults to defaultSearchMethod
, which uses the searchQuery
string to search for nodes with matching title
or subtitle
values. NOTE: Changing searchMethod
will not update the search, but changing the searchQuery
will.
({ node: object, path: number[] or string[], treeIndex: number, searchQuery: any }): bool
searchMethod
to highlight and scroll to matched nodes. Should be a string for the default searchMethod
, but can be anything when using a custom search. Defaults to null
. searchFocusOffset number Outline the <searchFocusOffset
>th node and scroll to it. onlyExpandSearchedNodes boolean Only expand the nodes that match searches. Collapses all other nodes. Defaults to false
. searchFinishCallback func Get the nodes that match the search criteria. Used for counting total matches, etc.
(matches: { node: object, path: number[] or string[], treeIndex: number }[]): void
false
.
({ node: object, prevPath: number[] or string[], prevTreeIndex: number, }): bool
{height: '100%'}
) innerStyle object Style applied to the inner, scrollable container (for padding, etc.) className string Class name for the container wrapping the tree rowHeight number or func Used by react-sortable-tree. Defaults to 62
. Either a fixed row height (number) or a function that returns the height of a row given its index: ({ treeIndex: number, node: object, path: number[] or string[] }): number
slideRegionSize number Size in px of the region near the edges that initiates scrolling on dragover. Defaults to 100
. scaffoldBlockPxWidth number The width of the blocks containing the lines representing the structure of the tree. Defaults to 44
. isVirtualized bool Set to false to disable virtualization. Defaults to true
. NOTE: Auto-scrolling while dragging, and scrolling to the searchFocusOffset
will be disabled. nodeContentRenderer any Override the default component (NodeRendererDefault
) for rendering nodes (but keep the scaffolding generator). This is a last resort for customization - most custom styling should be able to be solved with generateNodeProps
, a theme
or CSS rules. If you must use it, is best to copy the component in node-renderer-default.js
to use as a base, and customize as needed. placeholderRenderer any Override the default placeholder component (PlaceholderRendererDefault
) which is displayed when the tree is empty. This is an advanced option, and in most cases should probably be solved with a theme
or custom CSS instead.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4