Skip to content

Commit 6028054

Browse files
authored
docs: add container sizing documentation (#866)
Document the requirement for parent containers to have explicit dimensions, especially for vertical splits. This addresses a common issue where pane content appears invisible when the container has no defined height. - Add note in Quick Start section with link to details - Add Container Sizing section with problem description and solutions - Include code examples showing correct and incorrect usage Fixes #865
1 parent c1626a2 commit 6028054

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ function App() {
5151
}
5252
```
5353

54+
> **Note:** SplitPane requires its container to have explicit dimensions. The component uses `width: 100%` and `height: 100%`, so the parent element must have a defined size. For vertical splits, ensure the parent has an explicit height (e.g., `height: 100vh`). See [Container Sizing](#container-sizing) for details.
55+
5456
## Basic Usage
5557

5658
### Horizontal Split (Side-by-Side)
@@ -234,6 +236,58 @@ The divider is fully keyboard accessible:
234236
| `className` | `string` | - | CSS class name |
235237
| `style` | `CSSProperties` | - | Inline styles |
236238

239+
## Container Sizing
240+
241+
SplitPane uses `width: 100%` and `height: 100%` and measures its container via ResizeObserver. **The parent container must have explicit dimensions** for panes to render correctly.
242+
243+
### Common Issue: Invisible Panes
244+
245+
If your pane content doesn't appear, the most common cause is a missing height on the parent container. This is especially true for vertical splits:
246+
247+
```tsx
248+
// ❌ Won't work - parent has no height
249+
function App() {
250+
return (
251+
<div>
252+
<SplitPane direction="vertical">
253+
<Pane><div>Top</div></Pane>
254+
<Pane><div>Bottom</div></Pane>
255+
</SplitPane>
256+
</div>
257+
);
258+
}
259+
260+
// ✅ Works - parent has explicit height
261+
function App() {
262+
return (
263+
<div style={{ height: '100vh' }}>
264+
<SplitPane direction="vertical">
265+
<Pane><div>Top</div></Pane>
266+
<Pane><div>Bottom</div></Pane>
267+
</SplitPane>
268+
</div>
269+
);
270+
}
271+
```
272+
273+
### Solutions
274+
275+
1. **Set explicit height on parent** (recommended for most cases):
276+
```css
277+
.container { height: 100vh; }
278+
```
279+
280+
2. **Use absolute positioning**:
281+
```css
282+
.container { position: absolute; inset: 0; }
283+
```
284+
285+
3. **Use flexbox with flex-grow**:
286+
```css
287+
.parent { display: flex; flex-direction: column; height: 100vh; }
288+
.container { flex: 1; }
289+
```
290+
237291
## Styling
238292

239293
### Default Stylesheet

0 commit comments

Comments
 (0)