项目作者: OpusCapita

项目描述 :
React draggable split pane component
高级语言: CSS
项目地址: git://github.com/OpusCapita/react-splitpane.git
创建时间: 2018-03-14T06:44:58Z
项目社区:https://github.com/OpusCapita/react-splitpane

开源协议:MIT License

下载


react-splitpane

Description

Split-Pane component that stores it’s position to localStorage. Fires window resize event on resize to notify other components that container size has changed.
Uses react-split-pane component, check out more complex usage there.

Installation

  1. npm install @opuscapita/react-splitpane

Demo

View the DEMO

Builds

UMD

The default build with compiled styles in the .js file. Also minified version available in the lib/umd directory.

CommonJS/ES Module

You need to configure your module loader to use cjs or es fields of the package.json to use these module types.
Also you need to configure sass loader, since all the styles are in sass format.

API

Prop name Type Default Description
id string (required) Unique ID of the component
split string ‘vertical’ Split direction ‘vertical’ or ‘horizontal’
minSize string, number 50 Current size of the pane
defaultSize string, number ‘50%’ Initial size of the pane
rememberSize boolean true Store size to localStorage

Code example

  1. import React from 'react';
  2. import SplitPane from '@opuscapita/react-splitpane';
  3. handleResize = (id, size) => {
  4. console.log(id, 'changed size to', size);
  5. }
  6. export default class ReactView extends React.Component {
  7. render() {
  8. return (
  9. <SplitPane id="myVerticalPane">
  10. <div></div>
  11. <SplitPane id="myHorizontalPane" split="horizontal">
  12. <div></div>
  13. <div></div>
  14. </SplitPane>
  15. </SplitPane>
  16. );
  17. }
  18. }