# Resizable split

Give the center pane the content that should keep its space as a workspace narrows. Put navigation on the left, supplementary content on the right, or supply just one side. Each visible side takes a default width and minimum and maximum widths in CSS pixels.

```tsx
'use client'

import { ResizableSplit } from '@ancrel/workspace'
import '@ancrel/tokens/css'
import '@ancrel/workspace/styles.css'

export default function App() {
  return (
    <ResizableSplit
      left={<nav aria-label="Contents">Contents</nav>}
      leftConfig={{ defaultWidth: 240, minWidth: 180, maxWidth: 360 }}
      right={<aside aria-label="Notes">Notes</aside>}
      rightConfig={{ defaultWidth: 280, minWidth: 200, maxWidth: 480 }}
      labels={{ leftHandle: 'Resize contents', rightHandle: 'Resize notes' }}
      persistKey="reading-room"
    >
      <article><h2>Reading room</h2><p>Use either separator to make more room for the text.</p></article>
    </ResizableSplit>
  )
}
```

Expected:

### Reading room

Contents and Notes flank the article. In a wide container they start at 240 and 280 pixels.
Focus “Resize contents” and press Shift+Right to expand Contents to 288 pixels. Reload to retain that width.
Focus “Resize notes” and press Left to expand Notes to 296 pixels. Double-click that separator to restore 280 pixels.
Narrow the container to see the sides yield space to the article. Expand it again to restore the preferred widths.

## Resize a panel

Drag a separator or focus it with Tab. Left and Right move the separator by 16 pixels in the arrow's direction. Hold Shift for a 48-pixel step. Home and End select the current bounds. Double-click, Enter or 0 restores that panel's default. Give each separator a label that identifies the pane it controls.

The center requests 360 pixels by default. When space is short, the side panes give up width in proportion to their room above minimum. If both minimums cannot fit, the layout relaxes the center reservation and may reduce the sides below their configured minimums. In very tight containers the fallback floors are 140 pixels on the left and 160 on the right. The separator announces its effective bounds.

## Remember a layout

Give each workspace a distinct `persistKey`. The default adapter prefixes each key with `ac:split:v1:` and appends `:left` or `:right`. Server rendering and the first client render use the configured defaults. Saved preferences apply after hydration. Use `storage={null}` to keep widths local to the mounted split, or inject a `SplitStorage` adapter for another persistence mechanism. A reset writes an empty preference so later changes to the configured default take effect.

Use `onWidthsChange` to respond to a finished drag, keyboard adjustment or reset. Pointer moves preview the layout without sending a commit. For a custom layout, `computeEffectiveWidths` supplies the side widths, center width and effective bounds to pass into `ResizeHandle`.

## Styles

Import `@ancrel/tokens/css` and `@ancrel/workspace/styles.css` in the host. The visible separator uses `--ac-comp-split-handle-size`. Its larger pointer target uses `--ac-comp-split-handle-hitArea` and overlaps the pane edges without consuming their width budget.

| `Context` | `--ac-comp-split-handle-size` |
| - | - |
| `dark/compact` | `0.125rem` |
| `dark/comfortable` | `0.125rem` |
| `light/compact` | `0.125rem` |
| `light/comfortable` | `0.125rem` |

| `Context` | `--ac-comp-split-handle-hitArea` |
| - | - |
| `dark/compact` | `2rem` |
| `dark/comfortable` | `2.5rem` |
| `light/compact` | `2rem` |
| `light/comfortable` | `2.5rem` |

| `Prop` | `Type` | `Required` | `Default` |
| - | - | - | - |
| `children` | `ReactNode` | `true` | `—` |
| `className` | `string` | `false` | `—` |
| `key` | `React.Key \| null \| undefined` | `false` | `—` |
| `labels` | `Partial<ResizableSplitLabels>` | `false` | `—` |
| `left` | `ReactNode` | `false` | `—` |
| `leftConfig` | `SideConfig` | `false` | `—` |
| `minCenterWidth` | `number` | `false` | `—` |
| `onWidthsChange` | `((widths: SplitWidths) => void) \| undefined` | `false` | `—` |
| `persistKey` | `string` | `false` | `—` |
| `ref` | `React.Ref<HTMLDivElement> \| undefined` | `false` | `—` |
| `right` | `ReactNode` | `false` | `—` |
| `rightConfig` | `SideConfig` | `false` | `—` |
| `storage` | `SplitStorage \| null` | `false` | `—` |

```ts
import * as React from 'react';
import { ResizeHandle } from './handle.js';
import type { ResizableSplitProps, SplitStorage } from './types.js';
import { computeEffectiveWidths } from './widths.js';
export { ResizeHandle, computeEffectiveWidths };
export declare function createLocalStorageSplitStorage(namespace?: string): SplitStorage;
export declare const ResizableSplit: React.ForwardRefExoticComponent<ResizableSplitProps & React.RefAttributes<HTMLDivElement>>;
```

* default — dark/compact, dark/comfortable, light/compact, light/comfortable
* hover — dark/compact, dark/comfortable, light/compact, light/comfortable
* focus-visible — dark/compact, dark/comfortable, light/compact, light/comfortable
* active — dark/compact, dark/comfortable, light/compact, light/comfortable
