Components/Surfaces/Resizable
COMPONENT32.32

Resizable

Split panes with draggable dividers on plain flex and Pointer Events — no panel library. Arrow keys resize too.


INSTALL

1pnpm dlx @sayagodev/mo add resizable

Or import the files from the package (no copy):

1import "@sayagodev/mo/css/resizable.css";2import "@sayagodev/mo/js/resizable.js";

EXAMPLES

Default
Preview
Header
Content
With handle
One
Two
Three
Vertical
Header
Content
Collapsible
Collapsible

Drag the handle to collapse. Double-click the divider to toggle.

Main content

This panel fills the space when the sidebar is collapsed.

Three panels
Panel 1

33%

Panel 2

33%

Panel 3

33%

Nested (half + half split)
Left 50%
Top 25%
Bottom 25%
Half, and the other half split in two — like shadcn

USAGE

1<mo-resizable>2  <div data-resizable-panel>One</div>3  <div data-resizable-panel>Two</div>4</mo-resizable>5<!-- sleek 1px line by default; pill chip only with data-with-grip -->6<mo-resizable data-with-grip>7  <div data-resizable-panel>One</div>8  <div data-resizable-panel>Two</div>9</mo-resizable>10<mo-resizable data-orientation="vertical" data-sizes="25,75">11  <div data-resizable-panel data-min="20">Header</div>12  <div data-resizable-handle data-with-grip></div>13  <div data-resizable-panel>Content</div>14</mo-resizable>15<!-- or a custom manual grip (6 dots) -->16<mo-resizable>17  <div data-resizable-panel>One</div>18  <div data-resizable-handle><span data-resizable-grip><svg>●●/●●/●●</svg></span></div>19  <div data-resizable-panel>Two</div>20</mo-resizable>

API

NAMEKINDDESCRIPTION
<mo-resizable>elementSplit-pane group; emits mo-resize { sizes } on pointerup/keyup
data-orientationattributehorizontal (default) · vertical
data-sizesattributePanel percentages "25,75" — read on init, persisted live
[data-resizable-panel] + data-minattributePanel; minimum percent (default 10)
[data-resizable-panel] + data-collapsibleattributeMark a panel collapsible — dragging near 0 snaps closed; double-click handle toggles
[data-resizable-handle]attributeAuto-inserted hr if absent; focusable separator, arrows ±2% (Shift 10%)
[data-resizable-handle] + data-with-gripattributeShows the oval ⋮ chip (shadcn withHandle). Without it, just the sleek 1px line. Goes on the handle, or on the <mo-resizable data-with-grip> group for all handles.
[data-resizable-handle] > [data-resizable-grip]elementManual chip: drop your own SVG inside the handle for a custom grip (e.g. 6 dots ●●/●●/●●). If absent and data-with-grip is set, ⋮ is auto-injected.

FILES

src/css/resizable.csssrc/js/resizable.js
Install:mo add resizable

THEMING · PLAYGROUND

This is the exact component from the examples above, wearing a completely different theme. Edit the tokens and --mo-* hooks in the editor — autocomplete knows them all — and the preview obeys in real time. Your CSS always wins.

Tokens & hooks — edit live
Global tokens
--border--card--foreground--radius--ring
Component hooks
--mo-resizable-active--mo-resizable-hit--mo-resizable-line

Preview

Your CSS

Try it: type --mo- for the component hooks, or edit any value — the preview obeys in real time.