Gathering detailed insights and metrics for @kadira/react-split-pane
Gathering detailed insights and metrics for @kadira/react-split-pane
Gathering detailed insights and metrics for @kadira/react-split-pane
Gathering detailed insights and metrics for @kadira/react-split-pane
npm install @kadira/react-split-pane
Typescript
Module System
Node Version
NPM Version
64.9
Supply Chain
93.3
Quality
81.2
Maintenance
50
Vulnerability
99.6
License
Total Downloads
5,646,148
Last Day
492
Last Week
3,178
Last Month
13,264
Last Year
161,531
Minified
Minified + Gzipped
Latest Version
1.4.7
Package Id
@kadira/react-split-pane@1.4.7
Size
240.17 kB
NPM Version
3.9.3
Node Version
6.2.1
Published on
Jun 15, 2016
Cumulative downloads
Total Downloads
26
Split-Pane component built with React, can be split vertically or horizontally.
Check out the demo
1 <SplitPane split="vertical" minSize={50} defaultSize={100}> 2 <div></div> 3 <div></div> 4 </SplitPane>
1 <SplitPane split="vertical" minSize={50}> 2 <div></div> 3 <SplitPane split="horizontal"> 4 <div></div> 5 <div></div> 6 </SplitPane> 7 </SplitPane>
By dragging 'draggable' surface you can change size of the first pane.
The first pane keeps then its size while the second pane is resized by browser window.
By default it is the left pane for 'vertical' SplitPane and the top pane for 'horizontal' SplitPane.
If you want to keep size of the second pane and let the first pane to shrink or grow by browser window dimensions,
set SplitPane prop primary
to second
. In case of 'horizontal' SplitPane the height of bottom pane remains the same.
Resizing can be disabled by passing the enableResizing
prop as false
. Resizing is enabled by default.
You can also set the size of the pane using the size
prop. Note that a size set through props ignores the defaultSize
and minSize
properties.
In this example right pane keeps its width 200px while user is resizing browser window.
1 <SplitPane split="vertical" defaultSize={200} primary="second"> 2 <div></div> 3 <div></div> 4 </SplitPane>
Each SplitPane accepts an onChange function prop. Used in conjunction with defaultSize and a persistence layer, you can ensure that your splitter choices survive a refresh of your app.
For example, if you are comfortable with the trade-offs of localStorage, you could do something like the following:
1 <SplitPane split="vertical" minSize={50} 2 defaultSize={ localStorage.getItem('splitPos') } 3 onChange={ size => localStorage.setItem('splitPos', size) }> 4 <div></div> 5 <div></div> 6 </SplitPane>
Disclaimer: localStorage has a variety of performance trade-offs. Browsers such as Firefox have now optimized localStorage use so that they will asynchronously initiate a read of all saved localStorage data for an origin once they know the page will load. If the data has not fully loaded by the time code accesses localStorage, the code will cause the page's main thread to block until the database load completes. When the main thread is blocked, no other JS code will run or layout will occur. In multiprocess browsers and for users with fast disk storage, this will be less of a problem. You are likely to get yelled at if you use localStorage.
A potentially better idea is to use something like https://github.com/mozilla/localForage although hooking it up will be slightly more involved. You are likely to be admired by all for judiciously avoiding use of localStorage.
If you need more control over resizing, SplitPane can notify you about when resizing started
and when it ended through two callbacks: onDragStarted
and onDragFinished
.
By default it gives a 5 pixel wide divider, but you can use your own elements for the divider with the resizerChildren
property. Check the demo for a custom horizontal divider with a header and a button.
No vulnerabilities found.
No security vulnerabilities found.
Last Day
-38%
492
Compared to previous day
Last Week
-2.5%
3,178
Compared to previous week
Last Month
-7.6%
13,264
Compared to previous month
Last Year
55.1%
161,531
Compared to previous year