Skip to content

Commit fdf9d0b

Browse files
authored
Support overflowing content like drop-shadows (#678)
Changing the default [overflow](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/overflow) styles set by this library as shown below is enough to allow e.g. drop-shadows and other overflowing styles. <table><thead><tr><th>Before</th><th>After</th></tr></thead><tbody><tr><td> ```html <!-- ⚛️ Group --> <div data-group> <!-- ⚛️ Panel --> <div data-panel style="overflow: hidden" > <div> <!-- The stuff you render --> </div> </div> </div> ``` </td><td> ```html <!-- ⚛️ Group --> <div data-group> <!-- ⚛️ Panel --> <div data-panel style="overflow: visible" > <div style="overflow: auto"> <!-- The stuff you render --> </div> </div> </div> ``` </td></tr></tbody></table> Is this a change that users of this library would like? Will it somehow break or affect existing panel styles in an unexpected way? Try this out for yourself: ```sh npm install react-resizable-panels@alpha ``` I'd welcome feedback on the API and the documentation ([here](https://react-resizable-panels-git-discus-84d2c9-brian-vaughns-projects.vercel.app/examples/overflow)). In support of discussion #674 and issues #628 and #532
1 parent f7ed878 commit fdf9d0b

28 files changed

Lines changed: 233 additions & 19 deletions

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
/generated
44
/public
55

6+
src/routes/examples/*.html
7+
68
integrations/next/.next

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# Changelog
22

3+
## 4.7.1 (Unreleased)
4+
5+
- [678](https://github.com/bvaughn/react-resizable-panels/pull/678): Change default overflow styles to support shadows
6+
37
## 4.7.0
48

5-
= [677](https://github.com/bvaughn/react-resizable-panels/pull/677): Add `groupResizeBehavior` prop to `Panel`, enabling panels to retain their current size (pixels) size when the parent `Group` is resized.
9+
- [677](https://github.com/bvaughn/react-resizable-panels/pull/677): Add `groupResizeBehavior` prop to `Panel`, enabling panels to retain their current size (pixels) size when the parent `Group` is resized.
610

711
## 4.6.5
812

integrations/tests/src/components/PanelText.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { PropsWithChildren } from "react";
22

33
export function PanelText({ children }: PropsWithChildren) {
44
return (
5-
<div className="w-full h-full flex flex-col items-center justify-center p-1">
5+
<div className="w-full min-h-full flex flex-col items-center justify-center p-1">
66
{children}
77
</div>
88
);

integrations/tests/tests/cursor.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ test.describe("cursor", () => {
9191
<Panel id="top" minSize="25%" />
9292
<Separator id="vertical-separator" />
9393
<Panel id="bottom" minSize="25%">
94-
<Group orientation="horizontal">
94+
<Group className="relative top-[-5rem]" orientation="horizontal">
9595
<Panel id="left" minSize="25%" />
9696
<Separator />
9797
<Panel id="right" minSize="25%" />
@@ -178,7 +178,7 @@ test.describe("cursor", () => {
178178
<Panel id="top" minSize="25%" />
179179
<Separator id="vertical-separator" />
180180
<Panel id="bottom" minSize="25%">
181-
<Group orientation="horizontal">
181+
<Group className="relative top-[-5rem]" orientation="horizontal">
182182
<Panel id="left" minSize="25%" />
183183
<Separator />
184184
<Panel id="right" minSize="25%" />

lib/components/panel/Panel.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,7 @@ export function Panel({
160160
display: "flex",
161161
flexBasis: 0,
162162
flexShrink: 1,
163-
164-
// Prevent Panel content from interfering with panel size
165-
overflow: "hidden",
163+
overflow: "visible",
166164

167165
...JSON.parse(panelStylesString)
168166
}}
@@ -173,6 +171,7 @@ export function Panel({
173171
maxHeight: "100%",
174172
maxWidth: "100%",
175173
flexGrow: 1,
174+
overflow: "auto",
176175

177176
...style,
178177

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-resizable-panels",
3-
"version": "4.7.0",
3+
"version": "4.7.1-alpha.1",
44
"type": "module",
55
"author": "Brian Vaughn <brian.david.vaughn@gmail.com> (https://github.com/bvaughn/)",
66
"contributors": [
@@ -95,7 +95,7 @@
9595
"react-docgen-typescript": "^2.4.0",
9696
"react-dom": "^19.2.3",
9797
"react-error-boundary": "^6.0.0",
98-
"react-lib-tools": "^0.0.34",
98+
"react-lib-tools": "0.0.35",
9999
"react-router-dom": "^7.6.3",
100100
"rimraf": "^6.1.2",
101101
"rollup-plugin-terser": "^7.0.2",

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"html": "<div><span class=\"tok-comment\">&#60;!-- &#9883;️ Group --&#62;</span><span class=\"\"></span></div>\n<div><span class=\"\"></span><span class=\"tok-punctuation\">&#60;</span><span class=\"tok-typeName\">div</span><span class=\"\"> </span><span class=\"tok-propertyName\">data-group</span><span class=\"\"> </span><span class=\"tok-propertyName\">style</span><span class=\"tok-operator\">=</span><span class=\"tok-string\">\"</span><span class=\"tok-propertyName\">overflow</span><span class=\"tok-punctuation\">:</span><span class=\"\"> </span><span class=\"tok-atom\">hidden</span><span class=\"tok-string\">\"</span><span class=\"tok-punctuation\">&#62;</span><span class=\"\"></span></div>\n<div>&nbsp;</div>\n<div><span class=\"\"> </span><span class=\"tok-comment\">&#60;!-- &#9883;️ Panel --&#62;</span><span class=\"\"></span></div>\n<div><span class=\"\"> </span><span class=\"tok-punctuation\">&#60;</span><span class=\"tok-typeName\">div</span><span class=\"\"> </span><span class=\"tok-propertyName\">data-panel</span><span class=\"\"> </span><span class=\"tok-propertyName\">style</span><span class=\"tok-operator\">=</span><span class=\"tok-string\">\"</span><span class=\"tok-propertyName\">overflow</span><span class=\"tok-punctuation\">:</span><span class=\"\"> </span><span class=\"tok-atom\">visible</span><span class=\"tok-string\">\"</span><span class=\"tok-punctuation\">&#62;</span><span class=\"\"></span></div>\n<div><span class=\"\"> </span><span class=\"tok-punctuation\">&#60;</span><span class=\"tok-typeName\">div</span><span class=\"\"> </span><span class=\"tok-propertyName\">style</span><span class=\"tok-operator\">=</span><span class=\"tok-string\">\"</span><span class=\"tok-propertyName\">overflow</span><span class=\"tok-punctuation\">:</span><span class=\"\"> </span><span class=\"tok-atom\">auto</span><span class=\"tok-string\">\"</span><span class=\"tok-punctuation\">&#62;</span><span class=\"\"></span></div>\n<div>&nbsp;</div>\n<div><span class=\"\"> </span><span class=\"tok-comment\">&#60;!-- The stuff you render goes here --&#62;</span><span class=\"\"></span></div>\n<div><span class=\"\"> </span><span class=\"tok-punctuation\">&#60;/</span><span class=\"tok-typeName\">div</span><span class=\"tok-punctuation\">&#62;</span><span class=\"\"></span></div>\n<div><span class=\"\"> </span><span class=\"tok-punctuation\">&#60;/</span><span class=\"tok-typeName\">div</span><span class=\"tok-punctuation\">&#62;</span><span class=\"\"></span></div>\n<div><span class=\"\"></span><span class=\"tok-punctuation\">&#60;/</span><span class=\"tok-typeName\">div</span><span class=\"tok-punctuation\">&#62;</span></div>"
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"html": "<div><span class=\"tok-comment\">// Option 1: Override with className (must be !important)</span><span class=\"\"></span></div>\n<div><span class=\"\"></span><span class=\"tok-punctuation\">&#60;</span><span class=\"tok-typeName\">Group</span><span class=\"\"> </span><span class=\"tok-propertyName\">className</span><span class=\"tok-operator\">=</span><span class=\"tok-string\">\"overflow-visible!\"</span><span class=\"\"> </span><span class=\"tok-punctuation\">/&#62;</span></div>"
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"html": "<div><span class=\"tok-comment\">// Option 2: Override with style</span><span class=\"\"></span></div>\n<div><span class=\"\"></span><span class=\"tok-punctuation\">&#60;</span><span class=\"tok-typeName\">Group</span><span class=\"\"> </span><span class=\"tok-propertyName\">style</span><span class=\"tok-operator\">=</span><span class=\"tok-punctuation\">{</span><span class=\"tok-punctuation\">{</span><span class=\"\"> </span><span class=\"tok-propertyName tok-definition\">overflow</span><span class=\"tok-punctuation\">:</span><span class=\"\"> </span><span class=\"tok-string\">\"visible\"</span><span class=\"\"> </span><span class=\"tok-punctuation\">}</span><span class=\"tok-punctuation\">}</span><span class=\"\"> </span><span class=\"tok-punctuation\">/&#62;</span></div>"
3+
}

0 commit comments

Comments
 (0)