Snappy resizable panels

Most people have one width they like for a sidebar. They drag it back there again and again, but never to the exact same pixel. This sidebar learns that width and snaps to it. The chart above the window shows how.1

Remembering where the edge was left

Every time you let go, the width is saved as a mark. We never land on the same width twice, so we can't just count widths. Instead, each mark adds a small hill. Marks that land close together stack into a bigger hill.

Weighing newer drags more

Your preferred width can change. So newer marks count more than older ones. Every five drags, a mark's weight halves. A new habit takes over within a few drags.

How let-gos are weighed

Age is counted in drags, not days. If you don't touch the sidebar for a week, it still remembers your width.

Choosing the snap point

The snap point is the top of the tallest hill. It only shows up once about three recent drags agree. One random drag is never enough.

Once it's set, the snap point stays put. It only moves if the tallest hill ends up outside the snap zone. Otherwise it would shift a pixel with every drag.

Snapping and fine-tuning

When you drag close to the snap point, the edge sticks to it. Your cursor keeps moving, but the edge stays. If you let go there, the mark is saved at the snap point.

xyne
Spaces weekly sync
January 9, 2026 · Meera, Arjun, Kabir
Summary
Threads ship to everyone on Monday. Search inside a channel slips a week.
Next steps
Agreed before the call ended:
Arjun turns the threads flag on for all
Kabir writes the search fix up as a ticket
Meera moves the release note to Tuesday
Check unread counts in threads again on Friday
Demo threads at the all-hands
Try it yourself. Drag the edge near the snap point.

The catch is that you can't reach the widths right next to the snap point. So if you pause there for a moment, the snap lets go. Now the edge follows your cursor again, without jumping. Arrow keys never snap.

The hook

All of this is one hook, useSnapPoint, for version 4 of react-resizable-panels. Pass it the panel's id, and spread snap.group onto the Group.

Sizes are in pixels. The snap zone is 10px on each side by default. Nothing is saved between visits. To keep it, store samples and pass them back as initial.

Footnotes

  1. The notes window is inspired by a pin on Pinterest. ↩