Resizable
A Duostrap resizable split-panel layout with classic beveled gradients, #52a8ec focus glow, collapsible stops, and RTL support.
A Duostrap extension built on Base Resizable: handles feature the classic #fff → #e6e6e6 bevel gradient, inset highlight, optional recessed grip badge, and #52a8ec focus glow, with full multi-panel ratios, collapsing, RTL, and nested layouts.
Preview
Section titled “Preview”<proto-ui-duostrap-resizable-root
id="duostrap-resizable-hero"
class="h-56 w-full max-w-md rounded-[4px] border border-[#ccc] bg-background shadow-[0_1px_3px_rgb(0_0_0/5.5%)] overflow-hidden"
>
<proto-ui-duostrap-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">One</span>
</div>
</proto-ui-duostrap-resizable-panel>
<proto-ui-duostrap-resizable-handle></proto-ui-duostrap-resizable-handle>
<proto-ui-duostrap-resizable-panel>
<proto-ui-duostrap-resizable-root
id="duostrap-resizable-nested"
class="h-full w-full min-h-0"
>
<proto-ui-duostrap-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Two</span>
</div>
</proto-ui-duostrap-resizable-panel>
<proto-ui-duostrap-resizable-handle></proto-ui-duostrap-resizable-handle>
<proto-ui-duostrap-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Three</span>
</div>
</proto-ui-duostrap-resizable-panel>
</proto-ui-duostrap-resizable-root>
</proto-ui-duostrap-resizable-panel>
</proto-ui-duostrap-resizable-root>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const root = document.querySelector('#duostrap-resizable-hero');
const nestedRoot = document.querySelector(
'#duostrap-resizable-nested'
);
setElementProps(root, {
defaultSizes: [50, 50],
constraints: [
{ min: 20, max: 75, collapsible: true },
{ min: 25 },
],
});
setElementProps(nestedRoot, {
orientation: 'vertical',
defaultSizes: [25, 75],
constraints: [{ min: 20 }, { min: 25 }],
});
root
.querySelectorAll(':scope > proto-ui-duostrap-resizable-panel')
.forEach((panel, index) => setElementProps(panel, { index }));
setElementProps(
root.querySelector(
':scope > proto-ui-duostrap-resizable-handle'
),
{ index: 0, withHandle: true }
);
nestedRoot
.querySelectorAll(':scope > proto-ui-duostrap-resizable-panel')
.forEach((panel, index) => setElementProps(panel, { index }));
setElementProps(
nestedRoot.querySelector(
':scope > proto-ui-duostrap-resizable-handle'
),
{ index: 0, withHandle: true }
);
</script>Installation
Section titled “Installation”Available starting in 0.3.0-rc.1 and later releases. Import the prototypes directly from @proto.ui/prototypes-duostrap/resizable and adapt them for your target runtime:
import { resizableRoot, resizablePanel, resizableHandle,} from '@proto.ui/prototypes-duostrap/resizable';import { DuostrapResizableRoot, DuostrapResizablePanel, DuostrapResizableHandle,} from '../proto-ui/components/react';
export function Example() { return ( <DuostrapResizableRoot defaultSizes={[50, 50]} className="h-56 w-full max-w-md rounded-[4px] border border-[#ccc] bg-background shadow-[0_1px_3px_rgb(0_0_0/5.5%)] overflow-hidden" > <DuostrapResizablePanel index={0}>One</DuostrapResizablePanel> <DuostrapResizableHandle index={0} withHandle /> <DuostrapResizablePanel index={1}>Two</DuostrapResizablePanel> </DuostrapResizableRoot> );}Composition
Section titled “Composition”DuostrapResizableRoot├── DuostrapResizablePanel (index: 0)├── DuostrapResizableHandle (index: 0, withHandle?)└── DuostrapResizablePanel (index: 1)- Indexed panels and handles: render
NPanelparts (index: 0..N-1) andN - 1Handleparts (index: 0..N-2). Each handle resizes only its adjacent pair and defaults its accessible name toResize panels. - Classic Duostrap cues: directional
ew-resize/ns-resizecursors,#52a8ecfocus glow on keyboard focus, and flat#e6e6e6opacity-65styling when disabled. - Constraints and controlled state: configure per-panel
min,max,collapsible, andcollapsedSizeviaconstraints; supplysizesfor controlled mode and listen tosizesChange/sizesCommit.
Examples
Section titled “Examples”Vertical
Section titled “Vertical”Use orientation="vertical" for stacked resizable panes.
<proto-ui-duostrap-resizable-root
id="duostrap-resizable-vertical"
class="h-56 w-full max-w-md rounded-[4px] border border-[#ccc] bg-background shadow-[0_1px_3px_rgb(0_0_0/5.5%)] overflow-hidden"
>
<proto-ui-duostrap-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Header</span>
</div>
</proto-ui-duostrap-resizable-panel>
<proto-ui-duostrap-resizable-handle></proto-ui-duostrap-resizable-handle>
<proto-ui-duostrap-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Content</span>
</div>
</proto-ui-duostrap-resizable-panel>
</proto-ui-duostrap-resizable-root>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const root = document.querySelector(
'#duostrap-resizable-vertical'
);
setElementProps(root, {
orientation: 'vertical',
defaultSizes: [25, 75],
constraints: [{ min: 20 }, { min: 25 }],
});
root
.querySelectorAll('proto-ui-duostrap-resizable-panel')
.forEach((panel, index) => setElementProps(panel, { index }));
setElementProps(
root.querySelector('proto-ui-duostrap-resizable-handle'),
{ index: 0 }
);
</script>Handle
Section titled “Handle”Enable withHandle to show a beveled grip badge, or omit it for the default 6px gradient divider bar.
<div class="flex w-full max-w-md flex-col gap-4">
<proto-ui-duostrap-resizable-root
id="duostrap-resizable-with-handle"
class="h-40 w-full max-w-md rounded-[4px] border border-[#ccc] bg-background shadow-[0_1px_3px_rgb(0_0_0/5.5%)] overflow-hidden"
>
<proto-ui-duostrap-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Sidebar</span>
</div>
</proto-ui-duostrap-resizable-panel>
<proto-ui-duostrap-resizable-handle></proto-ui-duostrap-resizable-handle>
<proto-ui-duostrap-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Content</span>
</div>
</proto-ui-duostrap-resizable-panel>
</proto-ui-duostrap-resizable-root>
<proto-ui-duostrap-resizable-root
id="duostrap-resizable-hairline"
class="h-32 w-full max-w-md rounded-[4px] border border-[#ccc] bg-background shadow-[0_1px_3px_rgb(0_0_0/5.5%)] overflow-hidden"
>
<proto-ui-duostrap-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Left</span>
</div>
</proto-ui-duostrap-resizable-panel>
<proto-ui-duostrap-resizable-handle></proto-ui-duostrap-resizable-handle>
<proto-ui-duostrap-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Right</span>
</div>
</proto-ui-duostrap-resizable-panel>
</proto-ui-duostrap-resizable-root>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const withGrip = document.querySelector(
'#duostrap-resizable-with-handle'
);
setElementProps(withGrip, {
defaultSizes: [25, 75],
constraints: [{ min: 15 }, { min: 30 }],
});
withGrip
.querySelectorAll('proto-ui-duostrap-resizable-panel')
.forEach((panel, index) => setElementProps(panel, { index }));
withGrip
.querySelectorAll('proto-ui-duostrap-resizable-handle')
.forEach((handle, index) =>
setElementProps(handle, { index, withHandle: true })
);
const hairline = document.querySelector(
'#duostrap-resizable-hairline'
);
setElementProps(hairline, {
defaultSizes: [50, 50],
constraints: [{ min: 20 }, { min: 20 }],
});
hairline
.querySelectorAll('proto-ui-duostrap-resizable-panel')
.forEach((panel, index) => setElementProps(panel, { index }));
setElementProps(
hairline.querySelector('proto-ui-duostrap-resizable-handle'),
{ index: 0, withHandle: false }
);
</script>Pass direction="rtl" to mirror panel order and horizontal keyboard increments.
<proto-ui-duostrap-resizable-root
id="duostrap-resizable-rtl"
class="h-56 w-full max-w-md rounded-[4px] border border-[#ccc] bg-background shadow-[0_1px_3px_rgb(0_0_0/5.5%)] overflow-hidden"
>
<proto-ui-duostrap-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">واحد</span>
</div>
</proto-ui-duostrap-resizable-panel>
<proto-ui-duostrap-resizable-handle></proto-ui-duostrap-resizable-handle>
<proto-ui-duostrap-resizable-panel>
<proto-ui-duostrap-resizable-root
id="duostrap-resizable-rtl-nested"
class="h-full w-full min-h-0"
>
<proto-ui-duostrap-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">اثنان</span>
</div>
</proto-ui-duostrap-resizable-panel>
<proto-ui-duostrap-resizable-handle></proto-ui-duostrap-resizable-handle>
<proto-ui-duostrap-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">ثلاثة</span>
</div>
</proto-ui-duostrap-resizable-panel>
</proto-ui-duostrap-resizable-root>
</proto-ui-duostrap-resizable-panel>
</proto-ui-duostrap-resizable-root>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const root = document.querySelector('#duostrap-resizable-rtl');
const nestedRoot = document.querySelector(
'#duostrap-resizable-rtl-nested'
);
setElementProps(root, {
direction: 'rtl',
defaultSizes: [50, 50],
constraints: [{ min: 20 }, { min: 20 }],
});
setElementProps(nestedRoot, {
orientation: 'vertical',
direction: 'rtl',
defaultSizes: [25, 75],
constraints: [{ min: 20 }, { min: 25 }],
});
root
.querySelectorAll(':scope > proto-ui-duostrap-resizable-panel')
.forEach((panel, index) => setElementProps(panel, { index }));
setElementProps(
root.querySelector(
':scope > proto-ui-duostrap-resizable-handle'
),
{ index: 0, withHandle: true }
);
nestedRoot
.querySelectorAll(':scope > proto-ui-duostrap-resizable-panel')
.forEach((panel, index) => setElementProps(panel, { index }));
setElementProps(
nestedRoot.querySelector(
':scope > proto-ui-duostrap-resizable-handle'
),
{ index: 0, withHandle: true }
);
</script>Multi-panel & Collapsible
Section titled “Multi-panel & Collapsible”Combine three panels with a collapsible sidebar. Focus the first handle and press Enter to toggle collapse.
<proto-ui-duostrap-resizable-root
id="duostrap-resizable-collapsible"
class="h-56 w-full max-w-2xl rounded-[4px] border border-[#ccc] bg-background shadow-[0_1px_3px_rgb(0_0_0/5.5%)] overflow-hidden"
>
<proto-ui-duostrap-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Sidebar</span>
</div>
</proto-ui-duostrap-resizable-panel>
<proto-ui-duostrap-resizable-handle></proto-ui-duostrap-resizable-handle>
<proto-ui-duostrap-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Editor</span>
</div>
</proto-ui-duostrap-resizable-panel>
<proto-ui-duostrap-resizable-handle></proto-ui-duostrap-resizable-handle>
<proto-ui-duostrap-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Inspector</span>
</div>
</proto-ui-duostrap-resizable-panel>
</proto-ui-duostrap-resizable-root>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const root = document.querySelector(
'#duostrap-resizable-collapsible'
);
setElementProps(root, {
defaultSizes: [25, 50, 25],
constraints: [
{ min: 15, max: 35, collapsible: true },
{ min: 30 },
{ min: 15, max: 35 },
],
});
root
.querySelectorAll('proto-ui-duostrap-resizable-panel')
.forEach((panel, index) => setElementProps(panel, { index }));
root
.querySelectorAll('proto-ui-duostrap-resizable-handle')
.forEach((handle, index) =>
setElementProps(handle, { index, withHandle: true })
);
</script>| Prop | Type | Default |
|---|---|---|
sizes | readonly number[] | — |
defaultSizes | readonly number[] | — |
constraints | readonly ResizablePanelConstraint[] | [] |
value | number | — |
defaultValue | number | 50 |
min | number | 10 |
max | number | 90 |
step | number | 1 |
collapsible | boolean | false |
disabled | boolean | false |
readOnly | boolean | false |
orientation | 'horizontal' 'vertical' | 'horizontal' |
direction | 'ltr' 'rtl' | 'ltr' |
Panel & Handle
Section titled “Panel & Handle”| Prop | Type | Default |
|---|---|---|
Panel.index | number | 0 |
Handle.index | number | 0 |
Handle.withHandle | boolean | false |
- Exposed states: Root exposes
valueandsizes; Panel exposessize; Handle exposesvalue,focusVisible, anddisabled. - Events & methods: Root emits
sizesChange,sizesCommit,valueChange, andvalueCommit, and exposesrequestResize(index, next, commit?),requestSizes(next, commit?),requestValue(next, commit?), andcancelResize().