# SplitPane

Two panes side by side that you can resize, also from the keyboard, stacking on small screens.

- **Use it for**: Two resizable panes, such as code and preview.
- **Not for**: Fixed layouts that never resize. Try [WorkspaceShell](https://unseenui.com/components/workspace-shell/).

## Installation

```bash
npm install @stackunseen/ui react-resizable-panels
```

## Usage

```tsx
import { SplitPane } from '@stackunseen/ui/layout';
import '@stackunseen/ui/styles.css';

<SplitPane presentation="responsive" label="Document workspace" primary={documentPane} secondary={detailsPane} sizes={sizes} onSizesChange={setSizes} />
```

## All props

| Prop | Type | Description |
| --- | --- | --- |
| `disabled` | `boolean` |  |
| `grip` | `ReactNode` | Decorative replacement for the grip; the separator keeps its name. |
| `label` (required) | `string` |  |
| `onSizesChange` | `((sizes: SplitPaneSizes, request: SplitPaneResizeRequest) => void)` |  |
| `orientation` | `"horizontal" \| "vertical"` |  |
| `presentation` | `"split" \| "stacked" \| "responsive"` | Stacked retains the same two panes in a vertical, bounded layout. |
| `primary` (required) | `SplitPanePanel` |  |
| `resizeLabel` | `string` |  |
| `secondary` (required) | `SplitPanePanel` |  |
| `sizes` (required) | `SplitPaneSizes` | Controlled percentages, totaling 100. |
| `stackAt` | `number` | Container width at which responsive switches to a vertical stack. |

## Keyboard

Tab reaches the named separator. Arrow keys resize along its orientation; keyboard resizing requests controlled sizes just like pointer resizing.

## Works with

[Sidecar](https://unseenui.com/components/sidecar/), [WorkspaceShell](https://unseenui.com/components/workspace-shell/)

Page: https://unseenui.com/components/split-pane/
