Skip to content

Customizable resize preview mode - #746

Merged
bvaughn merged 3 commits into
bvaughn:mainfrom
mwrshah:002-resizable-panel-mode
Sep 20, 2026
Merged

bvaughn merged 3 commits into
bvaughn:mainfrom
mwrshah:002-resizable-panel-mode

Conversation

@mwrshah

@mwrshah mwrshah commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Suggested implementation for #745.

Update: current implementation

Following the feedback below:

  • Group resizePreviewMode="panel" | "separator"; default remains live resizing.
  • React renders one preview using the Separator’s children, classes, and styles. Existing constraints apply; panels resize on release. No explicit Separator means no visible preview.
  • Keyboard/imperative resizing stays immediate. Preview styling: [data-resize-preview].
  • Demo added to the existing Resize behaviors page; generated docs updated.

Validation: 439 existing tests, TypeScript, lint, formatting, and a CDP drag check passed. No new performance claim or preview-specific test.

Original proposal — superseded

A slightly different proposed UX - not updating content in-panel while a drag is happening.

Delivers about 3× more pointer updates during dragging in the retained benchmark:

  • ~~Live: ~20 updates/sec.~~
  • ~~Freeze: ~60 updates/sec.~~
  • ~~Preview: ~60 updates/sec.~~

Add optional Panel mode="freeze" | "preview". optional props.

  • Freeze keeps content dimensions fixed while panel bounds move (hides scrollbars until release - I found it to be a bit weird to have a scrollbar showing in the middle of a component).
  • Preview moves a divider indicator and applies layout on release.
  • Omit the prop for normal live resizing; keyboard and imperative resizing remain immediate.

Extended the existing Nested groups example with a three-state toggle:

Original demo

Regression check

Identical production example, 1,000 rows, Chrome 152 headless, 6× CPU throttling, continuous five-second back-and-forth drag. Five alternating baseline/branch pairs: main 19.60 updates/sec; branch 19.96. Movement main-thread work differs by +0.08%. No meaningful live-mode throughput regression detected in this fixture.These are pointer updates, not FPS. Three additional samples per optional mode.

@vercel

vercel Bot commented Sep 14, 2026

Copy link
Copy Markdown

@mwrshah is attempting to deploy a commit to the Brian Vaughn's projects Team on Vercel.

A member of the Team first needs to authorize it.

@vercel

vercel Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
react-resizable-panels Ready Ready Preview Sep 20, 2026 4:22pm UTC

@bvaughn bvaughn left a comment •

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very neat idea and I'm in favor of adding this functionality to the package, but I think we should tweak a few things about it:

  • Move the prop from Panel to Group; this is something that I think should apply to the group as a whole
  • Drop the "freeze" option (I don't think it's offer much benefit over the "preview" option), so maybe something more like resizePreviewMode: "panel" | "separator"
  • Replace the imperative preview rendering code with declarative code (probably the Group should render a preview indicator when a drag is active)
  • If the thing being dragged is an actual Separator, the preview should look similar to it (similar size, maybe different style?); we probably want to think about how to allow users to customize the preview indicator too (maybe a new component type?)

I also think that- rather than adding a new docs route for this- we should rename the "Group resize behavior" tab to just "Resize behaviors" and add a section for this to that too. That seems pretty related/discoverable, more so than tacking it onto the nested groups example.

Not sure if you'd be interested in iterating on the above changes or if you'd rather leave that to me. I'll go ahead and start working on the above changes. Maybe it won't be too much effort :)

@mwrshah

mwrshah commented Sep 19, 2026

Copy link
Copy Markdown
Contributor Author

@bvaughn I would like to take a stab at it if you don't mind.

Agree with you, and appreciate the thought put into the advice. One thing I would push back on: freeze is sort of allowing the rest of the panels to visually alter live, while preview just moves the separator. I like how freeze looks, but it's subjective. And not entirely sure it won't add janky code to make it possible - especially that custom scrollbar hide . So I will proceed per your instructions. All good ideas: make it declarative, simllar / same separator style. not expanding docs.

@bvaughn

bvaughn commented Sep 19, 2026 via email

Copy link
Copy Markdown
Owner

@mwrshah
mwrshah force-pushed the 002-resizable-panel-mode branch from 08aaa9c to 9876053 Compare September 20, 2026 04:39
@mwrshah

mwrshah commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor Author

Hi! @bvaughn updated the implementation. Appreciate the time you've invested so far. I have mostly stuck to your suggestions, declaratively showing a preview during active resize, based on resizePreviewMode on Group. Reusing separator styles.

Opinionated calls taken:

  • Did not introduce dedicated styling prop for the preview though it can be restyled by targeting the data-resize-preview data attribute.
  • Preview doesn't show if there is no explicit Separator, though the interaction still works by deferring resize until release. Mainly because I did not want to introduce an opinionated default style with which to show the separator

@mwrshah
mwrshah marked this pull request as ready for review September 20, 2026 05:05
@bvaughn

bvaughn commented Sep 20, 2026

Copy link
Copy Markdown
Owner

Excellent! I'll take a look this morning 😄

@bvaughn

bvaughn commented Sep 20, 2026

Copy link
Copy Markdown
Owner

I've made a few changes to the docs (e.g. more examples) and to the API (e.g. show overlay previews for inactive separators that are impacted by a resize)

I think this feature is ready to go now! Thanks a ton for the collaboration!

@bvaughn
bvaughn merged commit 5ce42e8 into bvaughn:main Sep 20, 2026
7 checks passed
@bvaughn bvaughn changed the title 002-resizable-panel-mode Customizable resize preview mode Sep 20, 2026

This branch was successfully deployed

1 active deployment
Preview — 820f2d71 Deployed Sep 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants