react-split-pane is a modern, accessible, and TypeScript-first React component designed for creating resizable split layouts. The current stable version is v3.2.0, which is built entirely with React hooks and provides comprehensive type definitions. This library enables developers to create flexible layouts with multiple resizable panes, supporting both horizontal and vertical splits, as well as nested configurations. Key differentiators include full TypeScript support, robust accessibility features (keyboard navigation, ARIA), touch-friendly interactions for mobile devices, and easy theming via CSS variables. It boasts a small bundle size (< 5KB gzipped) and ensures performant resizing through requestAnimationFrame throttling. Releases are active, with several patches and minor versions pushed out for the v3 series, indicating ongoing development and maintenance.
npm install react-split-paneVerified import paths — ran on the pinned version, not inferred.
Demonstrates a basic horizontal split-pane layout with two functional components for a sidebar and main content, setting initial and minimum sizes.
Review the v3 documentation and examples for `SplitPane` and `Pane` components. Refactor existing split-pane implementations to conform to the new API, especially around event handlers and prop structures.
Ensure the parent element wrapping `SplitPane` has clearly defined `width` and `height` CSS properties. For full-viewport layouts, `height: 100vh` on the parent is a common solution.
Upgrade to `react-split-pane@3.0.5` or later. If your application relied on the previous proportional scaling behavior for controlled pixel-sized panes, you will need to adjust your layout logic.
When handling resize events, consider using `event.pointerType` ('mouse', 'touch', or 'pen') to differentiate input types within your callback logic. This may simplify existing conditional logic that previously checked for `MouseEvent` vs `TouchEvent`.Ensure the parent element of SplitPane has defined CSS properties for `width` and `height`, for example, `<div style={{ width: '100%', height: '100vh' }}><SplitPane>...</SplitPane></div>`.Implement the `usePersistence` hook from `react-split-pane/persistence` to save and restore pane sizes to `localStorage` or `sessionStorage`.
Migrate your import statements from `const { SplitPane } = require('react-split-pane');` to `import { SplitPane } from 'react-split-pane';`.