Skip to content

react-simple-tree-menu

A small, accessible, zero-dependency tree menu for React — 3 KB, drops into Tailwind v4 projects with zero config, works back to React 16.14.
Installation
npm install react-simple-tree-menu
import TreeMenu from 'react-simple-tree-menu';
import 'react-simple-tree-menu/styles';
<TreeMenu
data={tree}
initialOpenNodes={['fruit']}
initialActiveKey="fruit/apple"
onClickItem={({ key }) => {
console.log(key);
}}
/>;

3 KB, zero runtime deps

Minified + brotli bundle under 3.5 KB. React is the only peer dependency.

Accessibility, done

WAI-ARIA tree pattern, roving tabindex, programmatic focus movement, full keyboard nav out of the box.

Render-props escape hatch

Use the default UI, or pass a function child and render whatever you want — flat, nested, or virtualized.

Theme with one variable

Every color, spacing, and font value is a --rstm-* CSS custom property. Override globally, per-theme, or per-panel.

Drops into Tailwind v4 projects

Your theme’s --color-* and --font-sans tokens flow into the tree automatically — no preset to install, no content globs to add. Or go fully headless: pass classNames and skip our CSS import entirely.

Works with any React

Tested against React 16.14, 17, 18, and 19 on every commit. useDeferredValue is picked up automatically on 18+.