Imports
import {
ResizablePanel,
type ResizablePanelDirection,
type ResizablePanelResizeEvent,
} from '@beehexa/vue-components';
import '@beehexa/vue-components/css';
Vue 3.5+ is a peer; @beehexa/design-tokens is the only package dependency.
The CSS export is typed for strict side-effect imports and includes source-token
CSS. The component uses a TypeScript render function, so consuming its built ESM
does not require an SFC compiler or Ant Design Vue. Use the actual local package
reference until an authorized registry release exists; source 0.0.0 is private,
not a published version claim.
Props and slots
| Prop | Type | Default | Contract |
|---|---|---|---|
direction |
'horizontal' or 'vertical' |
'horizontal' |
Left/right or top/bottom panes. Consumer owns breakpoints. |
ratio |
number |
0.5 |
Requested first-pane fraction; v-model:ratio. |
min |
number |
100 |
CSS-pixel minimum for each pane; use 0 for endpoint collapse. |
max |
number |
Infinity |
First-pane CSS-pixel maximum. |
preserveMinimum |
boolean |
false |
Explicit document-access mode: retain the existing per-pane min plus the physical gutter along the active axis. The ancestor must provide real overflow access; ordinary bounded panes still relax minima. |
minRatio |
number |
0 |
Lower first-pane fraction in [0, 1]. |
maxRatio |
number |
1 |
Upper first-pane fraction in [0, 1]. |
secondVisible |
boolean |
true |
Hide/inert second pane without unmounting it; first fills host and ratio restores on show. |
resizerSize |
string |
'90%' |
Reactive CSS length/percentage for visible divider-line cross-axis length, centered and capped at host length. |
separatorLabel |
string |
'Resize panels' |
Consumer-localized accessible name. |
#first and #second supply the two retained pane subtrees. The component owns
no heading, editor model, chart zoom, application locale or fullscreen state.
Pixel minima relax equally when the host cannot fit both; explicit maximums win incompatible minima. Equal live bounds disable interaction while retaining the physical gutter; equal endpoint bounds also hide it. Live constraints cancel active gestures without unmounting either pane. Temporary host constraints clamp layout without replacing the requested model ratio. Enter/double-click resets to the ratio captured at initial construction, within current constraints; programmatic changes do not redefine that reset point.
Events and types
type ResizablePanelDirection = 'horizontal' | 'vertical';
interface ResizablePanelResizeEvent {
ratio: number;
direction: ResizablePanelDirection;
first: { width: number; height: number };
second: { width: number; height: number };
source: 'pointer' | 'keyboard' | 'container' | 'programmatic';
}
| Event | Payload | When |
|---|---|---|
update:ratio |
number |
Pointer/keyboard changes request a bounded first-pane fraction. |
resize-start |
ResizablePanelResizeEvent |
Pointer starts, supported keyboard gesture starts, or explicit reset starts. |
resize |
ResizablePanelResizeEvent |
Interactive ratio change; initial/container measurement; external model, direction, visibility or constraint change. |
resize-end |
ResizablePanelResizeEvent |
Up/cancel/lost capture/blur, keyboard keyup/focus loss, reset completion, or gesture termination by live prop changes. |
Measured events run after Vue updates the DOM and the next animation frame. Width
and height come from each pane’s actual rendered rectangle. A hidden second pane
reports zero; ratio remains the effective split fraction for restoration.
Movement events coalesce per frame without reordering start/end. A normal parent
v-model echo does not relabel the user’s event as programmatic. Container and
programmatic changes emit resize without fabricated interactive start/end.
Use these dimensions to relayout a retained editor/chart/workflow host, not to
change its key, model, zoom or mount state. The ResizeObserver and all gesture
listeners/capture/animation work clean up on unmount. SSR import/render is safe;
layout observation starts on mount and pane IDs use Vue’s SSR-safe useId.
shadcn-vue Resizable
In an app that uses shadcn-vue, the registry’s Resizable gives the same divider and grip, drawn from the same resize.* tokens, with the shadcn-vue API (ResizablePanelGroup, ResizablePanel, ResizableHandle):
npx shadcn-vue@latest add https://beehexa.design/r/resizable.json
<script setup lang="ts">
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from '@/components/ui/resizable'
const orders = ['#10482', '#10481', '#10480', '#10479']
</script>
<template>
<!-- The group needs a bounded size. Sizes are percent of the group; min-size keeps each side usable. -->
<div class="h-64 w-full max-w-160 overflow-hidden rounded-(--bh-radius-card) border-(length:--bh-border-width-default) border-(--bh-color-border) bg-(--bh-color-surface) [font:var(--bh-font-body-default)] text-(--bh-color-text)">
<ResizablePanelGroup direction="horizontal">
<ResizablePanel :default-size="35" :min-size="25">
<ul class="m-0 flex list-none flex-col p-(--bh-space-100)">
<li v-for="order in orders" :key="order" class="rounded-(--bh-radius-item) px-(--bh-space-item-x) py-(--bh-space-100)">{{ order }}</li>
</ul>
</ResizablePanel>
<ResizableHandle with-handle aria-label="Resize order list and details" />
<ResizablePanel :default-size="65" :min-size="40">
<div class="flex h-full flex-col gap-(--bh-space-050) p-(--bh-space-200)">
<span class="[font:var(--bh-font-heading-xsmall)]">Order #10482</span>
<span class="text-(--bh-color-text-subtle)">3 items, $128.00, paid</span>
</div>
</ResizablePanel>
</ResizablePanelGroup>
</div>
</template><script setup lang="ts">
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from '@/components/ui/resizable'
</script>
<template>
<!-- direction="vertical": panes on top of each other. Without with-handle, only the line shows; it still takes the keys. -->
<div class="h-72 w-full max-w-160 overflow-hidden rounded-(--bh-radius-card) border-(length:--bh-border-width-default) border-(--bh-color-border) bg-(--bh-color-surface) [font:var(--bh-font-body-default)] text-(--bh-color-text)">
<ResizablePanelGroup direction="vertical">
<ResizablePanel :default-size="60" :min-size="30">
<pre class="m-0 h-full overflow-auto p-(--bh-space-200) [font:var(--bh-font-code-default)]">order.total -> invoice.amount
order.tax -> invoice.tax_class
order.sku -> item.code</pre>
</ResizablePanel>
<ResizableHandle aria-label="Resize mapping and preview" />
<ResizablePanel :default-size="40" :min-size="20">
<div class="p-(--bh-space-200) text-(--bh-color-text-subtle)">Preview: 3 fields mapped, 0 errors.</div>
</ResizablePanel>
</ResizablePanelGroup>
</div>
</template>