You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Version 4 of react-resizable-panels offers more flexible size constraints– supporting units as pixels, percentages, REMs/EMs, and more. Support for server-rendering (including Server Components) has also been expanded.
Migrating from version 3 to 4
Refer to the docs for a complete list of props and API methods. Below are some examples of migrating from version 3 to 4, but first a couple of potential questions:
Q: Why'd you rename <component> or <prop>?
A: The most likely reason is that I think the new name more closely aligns with web standards like WAI-ARIA and CSS. For example, the PanelResizeHandle component was renamed to Separator to better align with the ARIA "separator" role and the direction prop was renamed to orientation to better align with the ARIA orientation attribute .
Q: Why'd you remove support for <feature>?
A: Probably because it wasn't used widely enough to justify the complexity required to maintain it. If it turns out that I'm mistaken, features can always be (re)added but it's more difficult to remove them.
Q: Were the onCollapse and onExpand event handlers removed?
A: Yes. Use the onResize event handler instead:
onResize={(size)=>{// Either thisconstisCollapsed=size===collapsedSize;// Or this:panelRef.isCollapsed();}}
Basic usage example
// Version 3import{PanelGroup,Panel,PanelResizeHandle}from"react-resizable-panels";<PanelGroupdirection="horizontal"><PaneldefaultSize={30}minSize={20}>left</Panel><PanelResizeHandle/><PaneldefaultSize={30}minSize={20}>right</Panel></PanelGroup>// Version 4import{Group,Panel,Separator}from"react-resizable-panels";<Grouporientation="horizontal"><PaneldefaultSize={30}minSize={20}>left</Panel><Separator/><PaneldefaultSize={30}minSize={20}>right</Panel></Group>
Persistent layouts using localStorage
// Version 3import{PanelGroup,Panel,PanelResizeHandle}from"react-resizable-panels";<PanelGroupautoSaveId="unique-group-id"direction="horizontal"><Panel>left</Panel><PanelResizeHandle/><Panel>right</Panel></PanelGroup>// Version 4import{Group,Panel,Separator,useDefaultLayout}from"react-resizable-panels";const{ defaultLayout, onLayoutChange }=useDefaultLayout({groupId: "unique-group-id",storage: localStorage});<GroupdefaultLayout={defaultLayout}onLayoutChange={onLayoutChange}><Panel>left</Panel><Separator/><Panel>right</Panel></Group>
[!NOTE]
Refer to the docs for examples of persistent layouts with server rendering and server components.
Conditional panels
// Version 3import{PanelGroup,Panel,PanelResizeHandle}from"react-resizable-panels";<PanelGroupautoSaveId="unique-group-id"direction="horizontal">{showLeftPanel&&(<><Panelid="left"order={1}>left</Panel><PanelResizeHandle/></>)}<Panelid="center"order={2}>center</Panel>{showRightPanel&&(<><PanelResizeHandle/><Panelid="right"order={3}>right</Panel></>)}</PanelGroup>// Version 4import{Group,Panel,Separator}from"react-resizable-panels";<Group>{showLeftPanel&&(<><Panelid="left">left</Panel><Separator/></>)}<Panelid="center">center</Panel>{showRightPanel&&(<><Separator/><Panelid="right">right</Panel></>)}</Group>
Imperative APIs
// Version 3import{PanelGroup,Panel,PanelResizeHandle}from"react-resizable-panels";importtype{ImperativePanelGroupHandle,ImperativePanelHandle}from"react-resizable-panels";constpanelRef=useRef<ImperativePanelHandle>(null);constpanelGroupRef=useRef<ImperativePanelGroupHandle>(null);<PanelGroupdirection="horizontal"ref={panelGroupRef}><Panelref={panelRef}>left</Panel><PanelResizeHandle/><Panel>right</Panel></PanelGroup>// Version 4import{Group,Panel,Separator,useGroupRef,usePanelRef}from"react-resizable-panels";constgroupRef=useGroupRef();constpanelRef=usePanelRef();<GroupgroupRef={groupRef}orientation="horizontal"><PanelpanelRef={panelRef}>left</Panel><Separator/><Panel>right</Panel></Group>
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - Between 12:00 AM and 03:59 AM, only on Monday ( * 0-3 * * 1 ) in timezone Europe/Amsterdam.
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
If you want to rebase/retry this PR, check this box
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Since the Component Names and API in react-resizable-panels@4 has changed, the shadcn Component Resizable needs to be changed with it.
The shadcn Community is already on this (shadcn-ui/ui#9141, shadcn-ui/ui#9131, shadcn-ui/ui#9124) so I've desided to wait until the Component is updated there.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependenciesPull requests that update a dependency filepackages/uiAnything related to the @northware/ui package
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
^3.0.6->^4.0.0Release Notes
bvaughn/react-resizable-panels (react-resizable-panels)
v4.0.0Compare Source
Version 4 of react-resizable-panels offers more flexible size constraints– supporting units as pixels, percentages, REMs/EMs, and more. Support for server-rendering (including Server Components) has also been expanded.
Migrating from version 3 to 4
Refer to the docs for a complete list of props and API methods. Below are some examples of migrating from version 3 to 4, but first a couple of potential questions:
PanelResizeHandlecomponent was renamed toSeparatorto better align with the ARIA "separator" role and thedirectionprop was renamed toorientationto better align with the ARIAorientationattribute .onCollapseandonExpandevent handlers removed?onResizeevent handler instead:Basic usage example
Persistent layouts using localStorage
Conditional panels
Imperative APIs
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - Between 12:00 AM and 03:59 AM, only on Monday ( * 0-3 * * 1 ) in timezone Europe/Amsterdam.
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.