Skip to content

Commit 032e47b

Browse files
authored
Update README (#305)
1 parent 85e8aa7 commit 032e47b

File tree

1 file changed

+50
-40
lines changed

1 file changed

+50
-40
lines changed

README.md

Lines changed: 50 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,44 @@
11
# React Split Pane
22

3-
Split-Pane component built with [React](http://facebook.github.io/react), can be split vertically or horizontally.
4-
5-
```
6-
npm install react-split-pane
7-
```
8-
3+
[![NPM version](https://img.shields.io/npm/v/react-split-pane.svg?style=flat)](https://www.npmjs.com/package/react-split-pane)
4+
![NPM license](https://img.shields.io/npm/l/react-split-pane.svg?style=flat)
5+
[![NPM total downloads](https://img.shields.io/npm/dt/react-split-pane.svg?style=flat)](https://npmcharts.com/compare/react-split-pane?minimal=true)
6+
[![NPM monthly downloads](https://img.shields.io/npm/dm/react-split-pane.svg?style=flat)](https://npmcharts.com/compare/react-split-pane?minimal=true)
97
[![Build Status](https://img.shields.io/travis/tomkp/react-split-pane/master.svg?style=flat-square)](https://travis-ci.org/tomkp/react-split-pane)
108
[![Coverage Status](https://img.shields.io/coveralls/tomkp/react-split-pane/master.svg?style=flat-square)](https://coveralls.io/r/tomkp/react-split-pane)
119

10+
Split-Pane React component, can be nested or split vertically or horizontally. Check out some demos [here](http://react-split-pane.surge.sh/)!
1211

13-
Check out the [demos](http://react-split-pane.surge.sh/)
12+
## Installing
13+
```sh
14+
npm install react-split-pane
15+
16+
# or if you use yarn
1417

18+
yarn add react-split-pane
19+
```
1520

21+
## Example Usage
1622
```html
17-
<SplitPane split="vertical" minSize={50} defaultSize={100}>
18-
<div></div>
19-
<div></div>
20-
</SplitPane>
23+
<SplitPane split="vertical" minSize={50} defaultSize={100}>
24+
<div></div>
25+
<div></div>
26+
</SplitPane>
2127
```
2228

2329
```html
24-
<SplitPane split="vertical" minSize={50}>
25-
<div></div>
26-
<SplitPane split="horizontal">
27-
<div></div>
28-
<div></div>
29-
</SplitPane>
30-
</SplitPane>
30+
<SplitPane split="vertical" minSize={50}>
31+
<div></div>
32+
<SplitPane split="horizontal">
33+
<div></div>
34+
<div></div>
35+
</SplitPane>
36+
</SplitPane>
3137
```
3238

33-
### Primary pane
39+
## Props
3440

41+
### primary
3542
By dragging 'draggable' surface you can change size of the first pane.
3643
The first pane keeps then its size while the second pane is resized by browser window.
3744
By default it is the left pane for 'vertical' SplitPane and the top pane for 'horizontal' SplitPane.
@@ -63,7 +70,25 @@ size of the 'resizable' pane in this case). This can be useful also in the full-
6370
### step
6471
You can use the step prop to only allow resizing in fixed increments.
6572

66-
### Persisting Positions
73+
### onDragStarted
74+
This callback is invoked when a drag starts.
75+
76+
### onDragFinished
77+
This callback is invoked when a drag ends.
78+
79+
### onChange
80+
This callback is invoked with the current drag during a drag event. It is recommended that it is wrapped in a debounce function.
81+
82+
### Inline Styles
83+
84+
You can also pass inline styles to the components via props. These are:
85+
86+
* `paneStyle` - Styling to be applied to both panes
87+
* `pane1Style` - Styling to be applied to the first pane, with precedence over `paneStyle`
88+
* `pane2Style` - Styling to be applied to the second pane, with precedence over `paneStyle`
89+
* `resizerStyle` - Styling to be applied to the resizer bar
90+
91+
## Persisting Positions
6792

6893
Each SplitPane accepts an onChange function prop. Used in conjunction with
6994
defaultSize and a persistence layer, you can ensure that your splitter choices
@@ -96,12 +121,7 @@ https://github.com/mozilla/localForage although hooking it up will be slightly
96121
more involved. You are likely to be admired by all for judiciously avoiding
97122
use of localStorage.
98123

99-
### Resizing callbacks
100-
101-
If you need more control over resizing, SplitPane can notify you about when resizing started
102-
and when it ended through two callbacks: `onDragStarted` and `onDragFinished`.
103-
104-
### Example styling
124+
## Example styling
105125

106126
This gives a single pixel wide divider, but with a 'grabbable' surface of 11 pixels.
107127

@@ -161,23 +181,13 @@ Thanks to ```background-clip: padding-box;``` for making transparent borders pos
161181
}
162182

163183
```
164-
### Inline Styles
165184

166-
You can also pass inline styles to the components via props. These are:
167-
168-
* `paneStyle` - Styling to be applied to both panes
169-
* `pane1Style` - Styling to be applied to the first pane, with precedence over `paneStyle`
170-
* `pane2Style` - Styling to be applied to the second pane, with precedence over `paneStyle`
171-
* `resizerStyle` - Styling to be applied to the resizer bar
185+
## Contributing
172186

173-
174-
### Contributing
175-
176-
I'm always happy to receive Pull Requests for contributions of any kind.
187+
I'm always happy to receive Pull Requests for contributions of any kind.
177188

178189
Please include tests and/or update the examples if possible.
179-
190+
180191
**I'm working on an updated version of this library, and looking for help:** https://github.com/tomkp/react-split-pane/pull/240
181-
192+
182193
Thanks, Tom
183-

0 commit comments

Comments
 (0)