﻿# nf-resizable-panels {#resizable-panels}

Resizable panels with horizontal/vertical layouts, minimum sizes and local caching.

Import the components below; see the package README for standalone installation.

## Examples {#examples}

### Basic usage {#example-1}

### Basic usage
```vue
<script setup>
import { ref } from 'vue'
import { NfConfigProvider, NfResizablePanels } from '@94ai-plus/common-ui'
const resizes = ref(0)
</script>

<template>
  <NfConfigProvider theme="chalk" locale="zh-CN">
    <NfResizablePanels cached unique="docs-row" :resize-min-width="80" style="height:160px" @resize="resizes++">
      <section style="flex:1">Left</section>
      <section style="flex:2">Right</section>
    </NfResizablePanels>
    <output>resize: {{ resizes }}</output>
  </NfConfigProvider>
</template>

<style scoped lang="scss">
.nf-resizable-panels section { padding: 16px; background: var(--el-fill-color-light); }
</style>
```

### More examples 2 {#example-2}

### More examples 2
```vue
<script setup>
import { NfConfigProvider, NfResizablePanels } from '@94ai-plus/common-ui'
</script>

<template>
  <NfConfigProvider theme="chalk" locale="zh-CN">
    <NfResizablePanels drag-direction="column" symbol-mode="border" fill-seperator seperator-position="center" :seperator-size="8" :resize-min-width="40" divide-type="flex" style="height:240px">
      <section class="demo-panel" style="flex:1">Top</section>
      <section class="demo-panel demo-panel--accent" style="flex:1">Bottom</section>
      <template #seperator-symbol><span aria-hidden="true">⠿</span></template>
    </NfResizablePanels>
  </NfConfigProvider>
</template>

<style scoped>
.demo-panel {
  padding: 16px;
  background: var(--el-fill-color-light);
}
.demo-panel--accent {
  background: var(--el-color-primary-light-9);
}
</style>
```

### More examples 3 {#example-3}

### More examples 3
```vue
<script setup>
import { ref } from 'vue'
import { NfConfigProvider, NfResizablePanels, NfButton } from '@94ai-plus/common-ui'
const extra = ref(true)
</script>

<template>
  <NfConfigProvider theme="chalk" locale="zh-CN">
    <NfButton @click="extra = !extra">Toggle panel</NfButton>
    <NfResizablePanels style="height:180px" :resize-min-width="40">
      <section class="demo-panel" style="flex:1">A</section>
      <NfResizablePanels drag-direction="column" style="flex:1">
        <section class="demo-panel demo-panel--accent" style="flex:1">B</section>
        <section class="demo-panel" style="flex:1">C</section>
      </NfResizablePanels>
      <section v-if="extra" class="demo-panel demo-panel--accent" style="flex:1">D</section>
    </NfResizablePanels>
  </NfConfigProvider>
</template>

<style scoped>
.demo-panel {
  padding: 16px;
  background: var(--el-fill-color-light);
}
.demo-panel--accent {
  background: var(--el-color-primary-light-9);
}
</style>
```

## Props {#props}

Text props follow the library language when omitted; defaults below use this language.

| Parameter | Description | Type | Options | Default |
| --- | --- | --- | --- | --- |
| `resizablePanelsContainerTag` | Container tag. | `string` | — | `'div'` |
| `seperatorSize` | Separator width in pixels; 0 uses the theme default. | `number` | — | `0` |
| `fillSeperator` | Fill the separator; shown on hover in border mode. | `boolean` | — | `false` |
| `dragDirection` | Drag direction: row is horizontal, column is vertical. | `string` | row / column | `'row'` |
| `resizeMinWidth` | Minimum resize dimension: width for row, height for column. | `number` | — | `0` |
| `symbolMode` | Separator symbol or border mode. | `string` | symbol / border | `'symbol'` |
| `seperatorPosition` | Separator position. | `string` | start / end / center | `'start'` |
| `unique` | Cache identifier; use a different value for each layout. | `string` | — | `'resiable-panel-child'` |
| `divideType` | Resize via flex-basis or width/height. | `string` | flex / calc | `'calc'` |
| `cached` | Cache panel sizes after dragging. | `boolean` | — | `false` |

## Events {#events}

| Event | Description | Payload |
| --- | --- | --- |
| `resize` | Fires on drag release and after keyboard resizing. | — |

## Slots {#slots}

| Parameter | Description | Payload |
| --- | --- | --- |
| `default` | Direct child panels; give them initial dimensions or flex. | — |
| `seperator-symbol` | Custom separator symbol. | — |

## Methods {#methods}

| Name | Type | Description |
| --- | --- | --- |
| `refresh()` | `void` | Recollect panels and read compatible cache. |

## Migration notes {#migration}

Legacy `seperator*` spellings and the `nf-resizable-panels-${unique}` key are preserved. Cache restores only when panel count matches and total size differs by at most 4px. Arrow keys resize by 10px, Shift+Arrow by 1px. Drag listeners are cleaned up.
