Splitter
Resizable split pane layout
Source
LLM docs
Docs
Package
Usage
Splitter component provides resizable split pane layout. It is built on top of the
use-splitter hook and provides a declarative API with
Styles API integration.
Vertical orientation
Set orientation="vertical" to split panes vertically:
Collapsible panes
Set collapsible prop on Splitter.Pane to allow the pane to be collapsed
by dragging past its minimum size. Use splitterRef to access imperative API
for programmatic collapse/expand:
Controlled
To control panel sizes, use sizes and onSizeChange props:
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
When using multiple panes, set redistribute prop to control how space is borrowed from
non-adjacent panels when the immediate neighbor is at its min/max:
Line size
Use lineSize prop to control 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:
Imperative API
Use splitterRef prop to access imperative splitter API:
Wrap Splitter.Pane
Splitter component relies on Splitter.Pane order. Wrapping Splitter.Pane is not supported,
Splitter.Pane must be a direct child of Splitter.
use-splitter hook
Splitter component is built on top of the use-splitter hook.
If you need more control over the layout and styling, you can use the hook directly.