Split pane
A desktop-grade resizable dual panel. Zero-lag drag, rubber-band spring limits, and double-click preset snapping.
Used forCode and docs editorsMaster and detail layoutsConsoles and logsComparison screens
Install with the shadcn CLI
Older shadcn CLI, or a network that blocks ui.shadcn.com? Install by URL: shadcn add https://hairlineui.com/r/split-pane.json. More
Templates
Need the whole page?
65 Next.js landing pages, each designed from scratch. Try any of them live; one is $39, all of them $159, and 8 are free.
Where it’s used
Code and docs editors
An editor on one side and a live preview on the other.
Master and detail layouts
A list on the left with the selected item on the right.
Consoles and logs
Output beside the tool that produced it.
Comparison screens
Two versions or two documents side by side.
What it handles for you
Two panels that share a screen need a divider that feels right: it follows the pointer, resists at the limits, and can be reset in a double-click.
Dragging with no lag
The divider updates the panes directly, without React re-rendering them.
Rubber-band limits
Pulling past the minimum or maximum meets resistance, then springs back.
Double-click to snap
Double-clicking the divider eases between 50/50, 25/75 and 75/25.
Collapse either pane
Arrows on the divider fold a pane away so the other fills the frame.
Horizontal or vertical
Split side by side or top and bottom.
Keyboard control
The divider is a separator: arrow keys step by 1% (10% with Shift), Enter snaps to 50/50, and Home and End jump to the limits.
Overview
Divide views cleanly with a 1px hairline boundary. Dragging adjusts panel ratios with immediate DOM updates, pulling past boundaries encounters logarithmic resistance before springing back through a damped harmonic oscillator (WAAPI), and double-clicking snaps cleanly between 50%, 25%, and 75% presets.
States
- resize
- Divider movement updates pane flex-basis directly without React state re-renders.
- rubber-band
- Dragging beyond min/max bounds introduces logarithmic resistance; release triggers a WAAPI spring back.
- snap
- Double-clicking the divider smoothly animates between 50/50, 25/75, and 75/25 presets over 380ms.
- collapse
- Collapse arrows fold either pane to 0 width, docking the hairline divider flush against the frame.
Usage
Works with
Side-by-side markdown and live preview
Build dual-surface workspaces with independent scroll containers and zero layout jitter. Ideal for code playgrounds, markdown editors, and comparison screens.
Props
- first / second
- React.ReactNode
- Content rendered inside the left/top and right/bottom panes.
- split / defaultSplit= 50
- number
- Controlled or initial percentage allocated to the first pane.
- minSize / maxSize= 15 / 85
- number
- Boundary thresholds in percentage before rubber-band resistance begins.
- orientation= "horizontal"
- "horizontal" | "vertical"
- Primary axis of separation.
- collapsible= true
- boolean
- Enables pane collapse buttons on the divider.
- disabled= false
- boolean
- Locks the divider in place and prevents resizing.
- onSplitChange
- (split: number) => void
- Fired during pointer movement with raw split percentages.
- onSplitCommit
- (split: number) => void
- Fired upon pointer release or keyboard snap with normalized value.
Accessibility and motion
- The divider button acts as a semantic role="separator" with aria-valuenow.
- Arrow keys step by 1% (10% with Shift); Enter snaps to 50/50; Home and End jump to minimum and maximum limits.
- Past boundary limits, WAAPI springFrames computes 33 keyframe values for fluid physical return.
- Reduced motion removes transitions and settles snapped positions immediately.
Requirements
React 19, Tailwind CSS v4 and shadcn/ui theme variables (any style, light and dark). Icons from lucide-react.
Source
Registry item: /r/split-pane.json


