Splitter
Resizable panels separated by handles you can drag or move with the keyboard.
Usage
Splitter lays panels out side by side (or stacked with orientation="vertical") and lets readers resize them with the handle between each pair. It follows the WAI-ARIA window splitter pattern:
Splitter- the root. Holds the sizes, as percentages in DOM order:defaultSizesto start from, orsizesandonSizesChangeto control them. Panels split evenly when you pass neither.SplitterPanel- one resizable region, with its ownminSizeandmaxSize. Acollapsiblepanel snaps tocollapsedSizewhen dragged past half its minimum.SplitterHandle- the line between 2 panels. Drag it, or focus it and use the arrow keys.gripadds a pill that marks it as draggable.
The root fills its container (h-full w-full), so give it, or its parent, a height. Panels clip their content, and a long one can scroll inside a ScrollArea.
Examples
Default
2 panels with their own minimum sizes and a grip on the handle.
Vertical
orientation="vertical" stacks the panels, and the handle moves up and down.
Nested
Put a Splitter inside a panel to build an editor-style layout. Each splitter resizes on its own axis.
Collapsible
A collapsible panel snaps shut when dragged past half its minSize, and Enter on the handle collapses or restores it. Control the sizes with sizes and onSizesChange to collapse it from a button too.
Remember the layout
onSizesCommitted fires once a drag ends or a key press settles, so it's the place to save the layout. Read it back into defaultSizes. This example keeps it in local storage with useLocalStorage, so a reload keeps your sizes.
RTL
Every Appica UI component supports right-to-left layouts out of the box. Set the dir attribute on a container (commonly your <html> element) so CSS logical properties resolve correctly, and wrap your tree in DirectionProvider so direction-aware behavior follows the same direction.
The first panel sits on the right, dragging follows the pointer, and the Left and Right arrow keys swap so each still moves the handle the way it points. For setup details and caveats, see the RTL guide.
API reference
Each part forwards every remaining prop to its <div>. The tables below list the Appica additions and the most common props.
Splitter
The root. Lays out its panels and holds their sizes.
SplitterPanel
One resizable region.
A collapsed panel exposes data-collapsed, for styling it as a rail.
SplitterHandle
The draggable line between 2 panels. It resizes the panel before it and the one after it.
The handle exposes data-dragging while it's dragged, and the root does too.
Accessibility
- Each handle is a focusable
separatorwitharia-valuenow,aria-valueminandaria-valuemax(the size and limits of the panel before it) andaria-controlspointing at that panel, following the WAI-ARIA window splitter pattern. - Left/Right (or Up/Down when vertical) move the handle by
keyboardStep, Home and End send the panel before it to its minimum and maximum, and Enter collapses or restores acollapsiblepanel. Left and Right swap in right-to-left layouts. - Give every handle an
aria-labelthat names what it resizes. There's no default, because only you know what the panels hold. - The handle line is 1px, with a wider invisible hit area that grows on touch screens.
- Color transitions on the handle are skipped when the user prefers reduced motion.