Skip to content
animorio
IT
All components

The resizable panels

Dialogs, Physics, HoverGSAPMediumCompressed weight: Demo 8.6 KBGSAP 28 KBFreeDownload the zip

One gesture, drag: the three panes of a small code editor, Files, Editor and Preview, in a rounded frame on white. The thin handles thicken under the pointer, follow the finger with a rubber band at the limits, glide a little when you let go and settle on the 25, 50 and 75 per cent lines; a side pane pulled past its edge closes, pulled back out it opens again.

The code

A folder that runs on its own: index.html, style.css, script.js and the libraries from a CDN. The React and Vue tabs hold the same demo as a ready component, which switches its animations off when it leaves the page.

<!doctype html>
<!--
  "The resizable panels" from Animorio · https://animorio.com
  License: free on your own sites and your clients’ sites, paid work included.
  Not for resale, redistribution, templates or code collections · https://animorio.com/en/license/
-->
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>The resizable panels</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/standard.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/geist-mono@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage">
    <!-- the resizable panels of a small code editor: Files, Editor and Preview side by side. The two thin handles
         thicken under the pointer, follow the finger with a rubber band at the limits, glide a little on release and
         settle on the 25, 50 and 75 lines; pull a side panel past its edge and it closes, pull it back and it opens -->
    <div class="split" data-split>
      <div class="split__frame" data-frame>
        <section class="pane pane--files" data-pane="files" aria-label="Files">
          <div class="pane__in">
            <header class="pane__head"><span class="pane__title">Files</span></header>
            <ul class="tree">
              <li class="tree__row tree__row--dir"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M2 4.6c0-.7.5-1.2 1.2-1.2h3l1.4 1.5h5.2c.7 0 1.2.5 1.2 1.2v5.6c0 .7-.5 1.2-1.2 1.2H3.2c-.7 0-1.2-.5-1.2-1.2Z"/></svg><span>src</span></li>
              <li class="tree__row tree__row--on"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4 2h5.4L12.5 5v8.6c0 .2-.2.4-.4.4H4c-.2 0-.4-.2-.4-.4V2.4c0-.2.2-.4.4-.4Z M9.2 2.2V5.2h3"/></svg><span>App.tsx</span></li>
              <li class="tree__row"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4 2h5.4L12.5 5v8.6c0 .2-.2.4-.4.4H4c-.2 0-.4-.2-.4-.4V2.4c0-.2.2-.4.4-.4Z M9.2 2.2V5.2h3"/></svg><span>Invoice.tsx</span></li>
              <li class="tree__row"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4 2h5.4L12.5 5v8.6c0 .2-.2.4-.4.4H4c-.2 0-.4-.2-.4-.4V2.4c0-.2.2-.4.4-.4Z M9.2 2.2V5.2h3"/></svg><span>theme.css</span></li>
              <li class="tree__row"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4 2h5.4L12.5 5v8.6c0 .2-.2.4-.4.4H4c-.2 0-.4-.2-.4-.4V2.4c0-.2.2-.4.4-.4Z M9.2 2.2V5.2h3"/></svg><span>README.md</span></li>
            </ul>
          </div>
        </section>

        <section class="pane pane--editor" data-pane="editor" aria-label="Editor">
          <div class="pane__in">
            <header class="pane__head"><span class="pane__tab">App.tsx</span></header>
            <pre class="code"><span class="ln">1</span><span class="k">import</span> { Invoice } <span class="k">from</span> <span class="s">'./Invoice'</span>
<span class="ln">2</span>
<span class="ln">3</span><span class="k">export default function</span> <span class="f">App</span>() {
<span class="ln">4</span>  <span class="k">return</span> (
<span class="ln">5</span>    &lt;<span class="f">Invoice</span>
<span class="ln">6</span>      client=<span class="s">"Northwind"</span>
<span class="ln">7</span>      total={<span class="n">1240</span>}
<span class="ln">8</span>      due=<span class="s">"Nov 14"</span> /&gt;
<span class="ln">9</span>  )
<span class="ln">10</span>}</pre>
          </div>
        </section>

        <section class="pane pane--preview" data-pane="preview" aria-label="Preview">
          <div class="pane__in">
            <header class="pane__head"><span class="pane__title">Preview</span></header>
            <div class="mini">
              <span class="mini__who">Northwind</span>
              <span class="mini__sum">$1,240.00</span>
              <span class="mini__due">Due Nov 14</span>
              <span class="mini__btn">Pay invoice</span>
            </div>
          </div>
        </section>

        <div class="guide" data-guide="0.25" aria-hidden="true"></div>
        <div class="guide" data-guide="0.5" aria-hidden="true"></div>
        <div class="guide" data-guide="0.75" aria-hidden="true"></div>

        <div class="handle" data-handle="0" role="separator" aria-orientation="vertical" aria-label="Resize Files" tabindex="0" aria-valuemin="0" aria-valuemax="100" aria-valuenow="25"><span class="handle__line"></span><span class="handle__grip"></span></div>
        <div class="handle" data-handle="1" role="separator" aria-orientation="vertical" aria-label="Resize Preview" tabindex="0" aria-valuemin="0" aria-valuemax="100" aria-valuenow="25"><span class="handle__line"></span><span class="handle__grip"></span></div>
      </div>

      <div class="pill" data-pill aria-hidden="true"><span data-pill-name>Files</span><b data-pill-val>25%</b></div>

      <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true">
        <g data-ghost-arrow><path d="M5 3.2 18.6 13.4l-6.3.6 3.6 6.7-2.4 1.3-3.6-6.8-4.9 4.2Z"/></g>
        <g data-ghost-resize><path class="ghost__bars" d="M9.8 6v12M14.2 6v12M7.4 9 4.2 12l3.2 3M16.6 9l3.2 3-3.2 3"/><path class="ghost__arrows" d="M9.8 6v12M14.2 6v12M7.4 9 4.2 12l3.2 3M16.6 9l3.2 3-3.2 3"/></g>
      </svg>
      <p class="sr" aria-live="polite" data-live></p>
    </div>
  </main>

  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
  <script src="script.js"></script>
</body>
</html>

Playground

Change values, colours and text with the controls and watch the animation respond live. Or write in the code yourself. Then download the folder with your changes.

73 values to change

Or ask your AI assistant for it

With the Animorio connector, Claude Code, ChatGPT, Cursor or VS Code take it from here, guide included, and fit it into your project. Paste this request:

Take “The resizable panels” from Animorio and fit it into my site
Platform licenseFree on your sites and your clients’ sites. Want it inside a website builder, a template platform or a client dashboard? There’s a license for agencies and platforms.

What it does

On a white background a frame with rounded corners, a one pixel border and a wide soft shadow, split into three panes: on the left Files, on the lightest grey, with the src folder and four line drawn files, App.tsx lit on a small white tile; in the middle the editor with ten lines of code in Geist Mono, grey line numbers and keywords in purple, green and blue; on the right Preview with the invoice that code draws, Northwind, $1,240.00, Due Nov 14 and the Pay invoice button. Between one pane and the next runs a hairline. Under the pointer the line thickens and a small white grip appears; pressed it turns blue and so does the grip. Dragging, the pane follows the finger with no lag, and beside the handle a black pill gives the pane name and its share, Preview 38%, with digits that do not jitter. Near 25, 50 or 75 per cent a dashed blue line appears. Past the limit the handle still gives a little, like a rubber band, and the grip squashes. Let go, the handle carries on for a moment with its speed and, if it lands near a line, settles on it with one pixel too many while the line flashes. Pull Files past the edge and the pane snaps shut, first the words then the icons; pull the handle back out and it springs open. A double click puts the handle back. Until you touch it, a demo pointer shows the gestures by itself.

How it works

Each handle is a point on a spring

The two handles have a position x, a speed v and a target t, as shares of the width. On every frame the spring pulls x towards t (k times the distance minus the damping times the speed), in three sub steps with the time step capped at 1/30 of a second. While you drag the spring is very stiff and has no bounce, so the pane follows the finger one to one; when you let go it softens to STIFFNESS and DAMPING, and below 1 the damping leaves one pixel too many.

The rubber band at the limits

The limits of one handle depend on the other: Files and Preview never go below SIDE_MIN, the editor never below EDITOR_MIN. Past a limit the target does not stop: it moves by d times RUBBER over (1 + 6d), so it gives less and less the further you pull. The grip squashes to match, through a CSS variable.

Inertia and snapping

While dragging, the last 90 milliseconds of positions are kept. On release the speed is their slope; the goal is where that speed would carry the handle in INERTIA seconds, kept inside the limits. If one of the SNAPS lines is within SNAP_RANGE, the goal becomes that line and its dashed guide flashes. The spring starts with the finger’s speed, so the handle does not stop and start again: it glides.

Closing and opening a pane

If the finger takes Files or Preview below CLOSE_AT, the target jumps to the edge and the pane shuts on the spring; you have to pull a little further, CLOSE_AT plus 4 per cent, to open it again, so it does not flicker at the border. Inside the panes container queries do the work: under 104 pixels the file names go and the icons stay, under 44 everything fades with a touch of blur.

Accessible and keyboard friendly

The handles are role separator with aria-valuenow and an aria-valuetext that gives the pane name and its share. Arrow keys move them by 2 per cent, with Shift by 10, Home and End go to the limits, Enter closes and opens the pane. Touching the frame stops the demo pointer, which comes back after seven quiet seconds. With reduced motion the handles go straight to their place, with no spring and no demo pointer.

Values to change

NameFileDefaultWhat it changes
STARTscript.js[0.25, 0.75]Where the two handles rest at the start and after a double click, as shares of the width.
SNAPSscript.js[0.25, 0.5, 0.75]The lines the handles settle on when you let go near them.
SNAP_RANGEscript.js0.05How close to a line a handle has to land to settle on it.
SIDE_MINscript.js0.14The narrowest Files and Preview can be before they resist.
EDITOR_MINscript.js0.24The narrowest the editor can be.
CLOSE_ATscript.js0.06Below this share a side pane closes.
RUBBERscript.js0.32How much the handle still gives past a limit: 0 is a wall, 1 is no limit.
INERTIAscript.js0.16How far a handle glides after a flick, in seconds of its speed.
STIFFNESSscript.js340The stiffness of the spring that settles a released handle.
DAMPINGscript.js0.74The damping: below 1 the handle overshoots by a pixel before it stops.
AUTOPLAYscript.jstrueA demo pointer shows the gestures until you touch the panels.

Try them in the Playground

When to use it

For any app that puts two or three things side by side: an editor with its preview, an inbox with the open message, a dashboard with its sidebar, a CMS with the text and the page, a design tool with layers and properties.

On phones

The frame takes 92 per cent of the width and at most three quarters of the height; below 104 pixels the side panes show only their icons. The handles have an 18 pixel touch area and drag with a finger just as with a mouse; the rest of the frame lets the page scroll.

With reduced motion

The handles go straight where you take them, with no spring, rubber band or glide, the pill fades in and the demo pointer does not start.

Pitfalls

  • One spring is not enough: stiff and bounceless while dragging, because the pane must stay under the finger, and soft on release for the glide and the extra pixel. Both use the same point and only change k and the damping.
  • The release speed comes from the last 90 milliseconds and is zeroed if the finger had been still for more than 80: otherwise a handle held still and then let go set off with an old speed.
  • Closing and opening at the same border made the pane flicker while the finger stayed there: it closes below CLOSE_AT and opens again only above CLOSE_AT plus 4 per cent.
  • The demo pointer works in shares of the frame, not in pixels: the card window changes size while the demo runs, and the gestures stay on the handles.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, Geist Mono (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 8.6 KB; the libraries: GSAP 28 KB.

Testing

Tested on 24 October 2026

  • Desktop: Done
  • Phone: Done
  • Reduced motion: Done
  • Safari on iPhone: To do

License

Use it in your own projects and in your clients’ projects. Do not resell it or redistribute it as is. GSAP stays under its own Standard license. Full license.

All components