React Split Pane

3.2.0 · active · verified Sun Apr 19

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.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates a basic horizontal split-pane layout with two functional components for a sidebar and main content, setting initial and minimum sizes.

import React from 'react';
import { SplitPane, Pane } from 'react-split-pane';

interface SidebarProps {}
const Sidebar: React.FC<SidebarProps> = () => (
  <div style={{ padding: '20px', background: '#f0f0f0', height: '100%' }}>Sidebar Content</div>
);

interface MainContentProps {}
const MainContent: React.FC<MainContentProps> = () => (
  <div style={{ padding: '20px', background: '#e0e0e0', height: '100%' }}>Main Application Content</div>
);

function App() {
  return (
    <div style={{ width: '100%', height: '100vh', display: 'flex' }}>
      <SplitPane direction="horizontal">
        <Pane minSize="200px" defaultSize="300px">
          <Sidebar />
        </Pane>
        <Pane>
          <MainContent />
        </Pane>
      </SplitPane>
    </div>
  );
}

export default App;

view raw JSON →