Usage
Splitter is a resizable split pane layout. Double-click a handle to restore its two panes
to their default ratio, set resetOnDoubleClick={false} to disable it:
CSS units
defaultSize, min and max props of Splitter.Pane accept numbers, percentages and CSS units:
- A number or a
%string is a flexible size, the pane shares the leftover space with other flexible panes - A
pxorremstring is a fixed size, the pane keeps it when the container is resized
sizes and onSizeChange use the unit the pane was declared with:
Vertical orientation
Set orientation="vertical" to split panes vertically:
Collapsible panes
Set collapsible prop on Splitter.Pane to collapse the pane when it is dragged past its minimum size:
Controlled
Use sizes and onSizeChange props to control pane sizes. sizes must have one value
per pane, update it when you add or remove a pane:
Current sizes: [50, 50]
Multiple panes
Splitter supports any number of panes. Handles are automatically rendered between panes:
Nested splitters
You can nest Splitter components to create complex layouts:
Redistribute
Set redistribute prop to control how space is borrowed from non-adjacent panes
when the immediate neighbor has reached its min or max size:
Line size
Set lineSize prop to change the thickness of the separator line between panes:
Without handle
Set withHandle={false} to hide the thumb with grip icon. The separator line
between panes is still visible and draggable:
Handle props
Use getHandleProps(index) to customize individual separators, identified by their zero-based data-index attribute.
Set disabled to prevent dragging, keyboard resizing and double-click reset.
Set withHandle to override thumb visibility for that separator:
Imperative API
Use splitterRef prop to collapse, expand and resize panes programmatically:
Wrap Splitter.Pane
Splitter.Pane must be a direct child of Splitter, wrapping it in another component is not supported:
use-splitter hook
Splitter is built on top of the use-splitter hook.
Use the hook directly when you need full control over the layout and styling.