Skip to content

Commit 6eda032

Browse files
committed
docs: add v2.x to migration guide
Update the migration guide to explicitly cover v2.x users in addition to v0.1.x users, since both versions share the same API. Closes #863
1 parent 1f48a4d commit 6eda032

3 files changed

Lines changed: 30 additions & 28 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ All notable changes to this project will be documented in this file. See [standa
3232

3333
### Migration
3434

35-
See [MIGRATION.md](./MIGRATION.md) for detailed upgrade instructions from v0.1.x.
35+
See [MIGRATION.md](./MIGRATION.md) for detailed upgrade instructions from v0.1.x / v2.x.
3636

3737
### [0.1.92](https://github.com/tomkp/react-split-pane/compare/v0.1.91...v0.1.92) (2020-08-10)
3838

MIGRATION.md

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
# Migration Guide: v0.1.x to v3.0.0
1+
# Migration Guide: v0.1.x / v2.x to v3.0.0
22

3-
This guide will help you migrate from react-split-pane v0.1.x to v3.0.0. Version 3 is a complete rewrite with modern React patterns, TypeScript support, and improved accessibility.
3+
This guide will help you migrate from react-split-pane v0.1.x or v2.x to v3.0.0. Version 3 is a complete rewrite with modern React patterns, TypeScript support, and improved accessibility.
4+
5+
> **Note:** v2.x shared the same API as v0.1.x, so this guide applies to both versions.
46
57
## Overview of Changes
68

@@ -15,7 +17,7 @@ v3.0.0 introduces several breaking changes:
1517

1618
## Quick Migration
1719

18-
### Before (v0.1.x)
20+
### Before (v0.1.x / v2.x)
1921

2022
```jsx
2123
import SplitPane from 'react-split-pane';
@@ -46,7 +48,7 @@ import { SplitPane, Pane } from 'react-split-pane';
4648
### 1. Import Changes
4749

4850
```jsx
49-
// v0.1.x
51+
// v0.1.x / v2.x
5052
import SplitPane from 'react-split-pane';
5153

5254
// v3
@@ -55,10 +57,10 @@ import { SplitPane, Pane } from 'react-split-pane';
5557

5658
### 2. Children Must Be Wrapped in `<Pane>`
5759

58-
In v0.1.x, you could use any element as children. In v3, all children must be `<Pane>` components:
60+
In v0.1.x / v2.x, you could use any element as children. In v3, all children must be `<Pane>` components:
5961

6062
```jsx
61-
// v0.1.x
63+
// v0.1.x / v2.x
6264
<SplitPane split="vertical">
6365
<div>Pane 1</div>
6466
<div>Pane 2</div>
@@ -79,8 +81,8 @@ In v0.1.x, you could use any element as children. In v3, all children must be `<
7981

8082
The meaning of `vertical` and `horizontal` has been **swapped** to align with CSS flexbox terminology:
8183

82-
| v0.1.x | v3 | Layout |
83-
|--------|-----|--------|
84+
| v0.1.x / v2.x | v3 | Layout |
85+
|---------------|-----|--------|
8486
| `split="vertical"` | `direction="horizontal"` | Panes side-by-side (left/right) |
8587
| `split="horizontal"` | `direction="vertical"` | Panes stacked (top/bottom) |
8688

@@ -89,15 +91,15 @@ In v3, `direction` describes the flex direction:
8991
- `vertical` = panes arranged vertically (stacked)
9092

9193
```jsx
92-
// v0.1.x - side-by-side panes
94+
// v0.1.x / v2.x - side-by-side panes
9395
<SplitPane split="vertical">
9496

9597
// v3 - side-by-side panes
9698
<SplitPane direction="horizontal">
9799
```
98100

99101
```jsx
100-
// v0.1.x - stacked panes
102+
// v0.1.x / v2.x - stacked panes
101103
<SplitPane split="horizontal">
102104

103105
// v3 - stacked panes
@@ -109,7 +111,7 @@ In v3, `direction` describes the flex direction:
109111
Size constraints have moved from `<SplitPane>` to individual `<Pane>` components:
110112

111113
```jsx
112-
// v0.1.x
114+
// v0.1.x / v2.x
113115
<SplitPane split="vertical" minSize={50} maxSize={500} defaultSize={200}>
114116
<div>Pane 1</div>
115117
<div>Pane 2</div>
@@ -131,7 +133,7 @@ Size constraints have moved from `<SplitPane>` to individual `<Pane>` components
131133
v3 accepts both numbers (pixels) and strings with units:
132134

133135
```jsx
134-
// v0.1.x - numbers only (pixels)
136+
// v0.1.x / v2.x - numbers only (pixels)
135137
<SplitPane minSize={50} defaultSize={200}>
136138

137139
// v3 - numbers or strings with units
@@ -142,14 +144,14 @@ v3 accepts both numbers (pixels) and strings with units:
142144

143145
### 6. Callback Props Renamed
144146

145-
| v0.1.x | v3 | Notes |
146-
|--------|-----|-------|
147+
| v0.1.x / v2.x | v3 | Notes |
148+
|---------------|-----|-------|
147149
| `onDragStarted` | `onResizeStart` | Now receives `ResizeEvent` object |
148150
| `onChange` | `onResize` | Receives `(sizes[], event)` |
149151
| `onDragFinished` | `onResizeEnd` | Receives `(sizes[], event)` |
150152

151153
```jsx
152-
// v0.1.x
154+
// v0.1.x / v2.x
153155
<SplitPane
154156
onDragStarted={() => console.log('started')}
155157
onChange={(size) => console.log(size)}
@@ -174,7 +176,7 @@ The `ResizeEvent` object includes:
174176
The `primary` prop has been removed. In v3, sizes are distributed proportionally when the container resizes. For controlled sizing, use the `size` prop on each `<Pane>`:
175177

176178
```jsx
177-
// v0.1.x
179+
// v0.1.x / v2.x
178180
<SplitPane split="vertical" defaultSize={200} primary="second">
179181

180182
// v3 - use controlled mode with state
@@ -193,7 +195,7 @@ function App() {
193195
### 8. `allowResize` Renamed to `resizable`
194196

195197
```jsx
196-
// v0.1.x
198+
// v0.1.x / v2.x
197199
<SplitPane allowResize={false}>
198200

199201
// v3
@@ -205,7 +207,7 @@ function App() {
205207
The `step` prop now applies to keyboard navigation. Use `snapPoints` for drag snapping:
206208

207209
```jsx
208-
// v0.1.x - step for dragging
210+
// v0.1.x / v2.x - step for dragging
209211
<SplitPane step={50}>
210212

211213
// v3 - step for keyboard, snapPoints for dragging
@@ -220,24 +222,24 @@ The `step` prop now applies to keyboard navigation. Use `snapPoints` for drag sn
220222

221223
#### CSS Class Names Changed
222224

223-
| v0.1.x | v3 |
224-
|--------|-----|
225+
| v0.1.x / v2.x | v3 |
226+
|---------------|-----|
225227
| `SplitPane` | `split-pane` |
226228
| `Resizer` | `split-pane-divider` |
227229
| `Pane1`, `Pane2` | `split-pane-pane` |
228230

229231
#### Inline Style Props Changed
230232

231-
| v0.1.x | v3 |
232-
|--------|-----|
233+
| v0.1.x / v2.x | v3 |
234+
|---------------|-----|
233235
| `style` | `style` |
234236
| `paneStyle` | Use `<Pane style={}>` |
235237
| `pane1Style` | Use `<Pane style={}>` on first pane |
236238
| `pane2Style` | Use `<Pane style={}>` on second pane |
237239
| `resizerStyle` | `dividerStyle` |
238240

239241
```jsx
240-
// v0.1.x
242+
// v0.1.x / v2.x
241243
<SplitPane
242244
style={{ height: '100vh' }}
243245
pane1Style={{ background: 'red' }}
@@ -265,7 +267,7 @@ The `step` prop now applies to keyboard navigation. Use `snapPoints` for drag sn
265267
#### Custom Resizer → Custom Divider
266268

267269
```jsx
268-
// v0.1.x - CSS class customization
270+
// v0.1.x / v2.x - CSS class customization
269271
<SplitPane resizerClassName="my-resizer">
270272

271273
// v3 - custom component or className
@@ -286,7 +288,7 @@ function CustomDivider(props) {
286288
### 11. Persistence Pattern Updated
287289

288290
```jsx
289-
// v0.1.x
291+
// v0.1.x / v2.x
290292
<SplitPane
291293
defaultSize={parseInt(localStorage.getItem('splitPos'), 10) || 200}
292294
onChange={(size) => localStorage.setItem('splitPos', size)}
@@ -316,7 +318,7 @@ function App() {
316318
v3 supports 2+ panes natively (no nesting required):
317319

318320
```jsx
319-
// v0.1.x - required nesting for 3+ panes
321+
// v0.1.x / v2.x - required nesting for 3+ panes
320322
<SplitPane split="vertical">
321323
<div>Pane 1</div>
322324
<SplitPane split="vertical">

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ A subtle single-pixel divider:
345345

346346
React Split Pane works seamlessly with Tailwind CSS and shadcn/ui. See [TAILWIND.md](./TAILWIND.md) for detailed integration examples including custom dividers and CSS variable overrides.
347347

348-
## Migration from v0.1.x
348+
## Migration from v0.1.x / v2.x
349349

350350
See [MIGRATION.md](./MIGRATION.md) for detailed migration guide.
351351

0 commit comments

Comments
 (0)