2.0.1 • Published 8 months ago

@ihatecode/react-splitter v2.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

@ihatecode/react-splitter

Englist | 中文

Introduction

A split pane component written in React.

Install

# npm
npm install @ihatecode/react-splitter
# yarn
yarn add @ihatecode/react-splitter
# pnpm
pnpm add @ihatecode/react-splitter

Usage

import React from 'react';
import Splitter from '@ihatecode/react-splitter';
import '@ihatecode/react-splitter/lib/style.css';

const App: React.FC = () => {
  return (
    <Splitter
        items={[
            {
                size:200,
                min:100,
                max:300,
                content:<div>Left</div>
            },
            {
                size:'50%',
                min:'25%',
                max:'75%',
                content:<div>Right</div>
            }]
        }
    />
  );
};

export default App;

Demo

Online demo: https://rg4jgy.csb.app/

Edit react-splitter

Props

Splitter props

PropertyTypeOptionalDefault
resizablebooleanYtrue
classNamestringY
styleobjectY
direction'horizontal', 'vertical'Y'horizontal'
splitbarobjectY
itemsArrayN
onResize(sizes: { px: number, percent: number }[]) => voidY

Splitbar props

PropertyTypeOptionalDefault
sizenumberY1
colorstringY'#eee'

Splitter Item props

PropertyTypeOptionalRemark
keynumber/stringY
sizenumber/stringYpx: 100 or '100px'; percent: '50%'
minnumber/stringYsame as 'size'
maxnumber/stringYsame as 'size'
resizablebooleanYtrue
contentanyN
2.0.1

8 months ago

2.0.0

8 months ago

2.0.0-alpha.1

8 months ago

1.2.0

8 months ago

1.1.0

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago

1.0.0-alpha.1

9 months ago