Basic Horizontal Split

Simple two-pane horizontal layout with draggable divider. Demonstrates core resizing functionality with visual feedback showing percentage and pixel widths.

Left Pane

This is the left pane content. Drag the divider to resize!

Right Pane

This is the right pane content.

Basic Horizontal Split with Sidebar

Two-pane horizontal layout with minSize of 200 and initialSizes of [25,75] and Sidebar components on the left pane.

Right Pane

This is the right pane content. Lorem ipsum dolor sit, amet consectetur adipisicing elit. Impedit nulla ipsum inventore nihil labore in velit dolores consequatur, voluptas praesentium perferendis nobis sequi culpa laboriosam natus! Dignissimos exercitationem vitae necessitatibus.

Vertical Split (30/70)

Vertical layout with custom initial sizes and keyboard controls. Use arrow keys to adjust, Enter/Space to reset to equal distribution.

Top Pane (30%)

Tab to the divider and use arrow keys (↑/↓) for keyboard control.

Bottom Pane (70%)

Press Enter or Space on divider to reset to equal sizes.

Three Panes

Multiple panes in single container with individual dividers. Each pane can be resized independently while maintaining minimum size constraints.

Pane 1

First pane

Pane 2

Middle pane

Pane 3

Last pane

Responsive (switches to vertical on mobile)

Automatically switches between horizontal and vertical layouts based on viewport width. Features callback tracking for size change monitoring.

Pane A

Resize your browser window to see the layout change from horizontal to vertical at 768px.

Pane B

The onResize callback tracks size changes shown above.

Nested Split Panes

Complex layout combining horizontal and vertical splits. Creates sidebar with vertically-split main content area for advanced dashboard layouts.

Sidebar

Navigation or tools

Top Content

Main content area

Bottom Content

Footer or additional info

With Min Constraints (300px minimum)

Demonstrates minimum size enforcement. Panes cannot be resized below 300px, preventing content from becoming unusable during aggressive resizing.

Constrained Pane

This pane has:

  • Min size: 300px

Flexible Pane

This pane takes up the remaining space.

Code Editor Layout

Production-ready IDE-style interface with file explorer, code editor, and terminal. Shows practical implementation with nested panes and dark theme.

📁 Explorer

  • 📄 index.html
  • 📄 styles.css
  • 📄 script.js
  • 📄 App.svelte

script.js

JavaScript
function hello() {
  console.log('Hello World');
  return 'Welcome to SplitPane!';
}

hello();

Terminal

$ npm run dev

✓ Server running on http://localhost:5173

Press h to show help