npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@canpacis/split-pane-react-revised

v0.2.0

Published

Resizable split panes for React.js.

Downloads

8

Readme

中文

split-pane-react

Resizable split panes for React.js.Check out the live demo. Different themes.

Features

  • 💪Simple api and support for multiple panels.
  • 🔥Supports vertical & horizontal layouts and fluid pane.
  • 🎉Use controlled component mode, flexible use.
  • 😎React16.8 version at least, and React18 version at the same time.
  • 👷‍♂️Support flexible and convenient customization of sash.

Installing

# use npm
npm install @canpacis/split-pane-react-revised

# or if you use yarn
yarn add @canpacis/split-pane-react-revised

# pnpm
pnpm install @canpacis/split-pane-react-revised

Example Usage

import React, { useState } from 'react';
import SplitPane, { Pane } from '@canpacis/split-pane-react-revised';
import '@canpacis/split-pane-react-revised/esm/themes/default.css';

function style (color) {
  return {
    height: '100%',
    display: 'flex',
    alignItems: 'center',
    justifyContent: 'center',
    backgroundColor: color
  };
}

function App () {
  const [sizes, setSizes] = useState([100, '30%', 'auto']);

  return (
    <div style={{ height: 500 }}>
      <SplitPane
        split='vertical'
        sizes={sizes}
        onChange={setSizes}
      >
        <Pane minSize={50} maxSize='50%'>
          <div style={style('#ddd')}>
            pane1
          </div>
        </Pane>
        <div style={style('#ccc')}>
          pane2
        </div>
        <div style={style('#eee')}>
          pane3
        </div>
      </SplitPane>
    </div>
  );
};

props

SplitPane

| Property | Description | Type | Default | | -------------- | ---------------- | :--------: | :----------: | | split | Determine layout of panes. | 'vertical' |'horizontal' |'vertical' | | sizes | Collection of different panel sizes,Only support controlled mode, so it's required | (string | number)[] |[] | | resizerSize | Specify the size for resizer | number |4 | | allowResize | Should allowed to resized | boolean |true | | className | split pane custom class name | string |void | | sashRender | User defined sliding axis function | (index: number, active: boolean) => void |void | | performanceMode | High performance mode to avoid excessive pressure on the browser | boolean | false | | onChange | Callback of size change | (sizes: number[]) => void |void | | onDragStart | This callback is invoked when a drag starts | () => void |void | | onDragEnd | This callback is invoked when a drag ends | () => void |void |

Pane

| Property | Description | Type | Default | | ------------------ | ---------------- | :--------: | ------------------ | | className | pane class name | string | void | | minSize | Limit the minimum size of the panel | string | number | void | | maxSize | Limit the maximum size of this panel | string|number | void |

themes

You can use the sashRender parameter to configure the theme you need:

  • The default theme style refers to vscode style
  • At the same time, we have built in a theme similar to sublime
  • Other demo themes.

License

split-pane-react licensed under MIT.

PS: I would love to know if you're using split-pane-react. If you have any use problems, you can raise the issue, and I will repair them as soon as possible. The project will always be maintained. If you have a good idea, you can propose a merge. If this component helps you, please leave your star. Those who need it will be very grateful.