Skip to main content

React Apple Tree

A powerful React component for building drag-and-drop sortable hierarchical trees with search, virtualization, and full TypeScript support.

Quick Start

Get up and running with React Apple Tree in minutes

1

Install the package

Install React Apple Tree using your preferred package manager:
npm install @newtonschool/react-apple-tree
2

Import the component

Import ReactAppleTree into your React component:
import React, { useState } from 'react';
import ReactAppleTree from '@newtonschool/react-apple-tree';
3

Create your first tree

Set up your tree data and render the component:
const MyTree = () => {
  const [treeData, setTreeData] = useState([
    { title: 'Parent 1', children: [{ title: 'Child 1' }] },
    { title: 'Parent 2', children: [{ title: 'Child 2' }] },
  ]);

  return (
    <div style={{ height: 400 }}>
      <ReactAppleTree
        treeData={treeData}
        onChange={(newTreeData) => setTreeData(newTreeData)}
        getNodeKey={({ treeIndex }) => treeIndex}
      />
    </div>
  );
};
The tree requires a fixed height container to enable virtualization for optimal performance with large datasets.

Explore by Topic

Dive deeper into React Apple Tree’s capabilities

Core Concepts

Understand tree data structures, operations, and drag-and-drop mechanics

Examples

Explore practical examples from basic usage to advanced features

Props Reference

Complete reference for all component props and configuration options

Utility Functions

Powerful utilities for tree traversal, manipulation, and data conversion

Key Features

Everything you need for building hierarchical tree interfaces

🎯

Drag & Drop

Built on React DnD for smooth, intuitive drag-and-drop interactions

⚑

Virtualized

Handle thousands of nodes efficiently with react-window virtualization

πŸ”

Search & Filter

Built-in search with customizable methods and focus management

πŸ“˜

TypeScript

Full TypeScript support with comprehensive type definitions

🎨

Customizable

Flexible styling and rendering with custom node components

🌍

RTL Support

Right-to-left layout support for internationalization

Resources

Everything you need to succeed with React Apple Tree

GitHub

View source code, report issues, and contribute

npm Package

Install from npm and view package details

Storybook

Explore interactive examples and demos

Ready to get started?

Follow our quickstart guide to build your first tree in minutes

Get Started β†’

Build docs developers (and LLMs) love