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

react-resizing-pane

v1.1.0

Published

A lightweight, fully customizable, resizable component for React

Downloads

988

Readme

react-resizing-pane

A lightweight, fully customizable, resizable component for React

Installation

$ npm i react-resizing-pane
# or
$ yarn add react-resizing-pane

Screenshot

ResizingPane is just a div/component with some customizations, that allow it to listen for specific events and resize itself accordingly. Anything that can de done using a normal div/component, can also be done using ResizingPane.

Screenshot

Usage

Example:

import ResizingPane from 'react-resizing-pane';

const App = () => {
  return (
    <ResizingPane storageId={0} sides={['bottom', 'right']}>
      <div>Hello World!</div> {/* anything can be wrapped as a child */}
    </ResizingPane>
  );
};

Example with all props:

import ResizingPane from 'react-resizing-pane';

const App = () => {
  let storageConfig = { name: 'example', type: sessionStorage };

  return (
    <ResizingPane
      sides={['top', 'left', 'bottom', 'right']}
      storageId={0}
      storageConfig={storageConfig}
      height={300}
      width={450}
      style={{
        border: '5px solid blue',
        maxHeight: 400,
        maxWidth: 500,
        minHeight: 200,
        minWidth: 250,
      }}
    />
  );
};

Props

sides: (type: [options], default: undefined);

Can take four options:

  • 'top'
  • 'bottom'
  • 'left'
  • 'right'

Specifies the sides of ResizingPane that you want to be resizable.

storageId: (type: number | string, default: undefined);

Must be unique for every ResizingPane.

Use this if you want to persist height and width of ResizingPane div in your application.

storageConfig: (type: object, default: { name: 'dimensions', type: sessionStorage });

name: specifies the name by which it is persisted in the storage

type: specifies the type of storage to use - localStorage or sessionStorage (default)

Important: ResizingPane must contain storageId prop for storageConfig to work.

Use this if you want to overwrite the default settings.

height: (type: number, default: 250);

Must be a number only. Passing css units is not supported.

Use this if you want to set a default height.

width: (type: number, default: 350);

Must be a number only. Passing css units is not supported.

Use this if you want to set a default width.

Default Styles

border: '1px solid black'

maxHeight: '100%'

maxWidth: '100%'

Note: To overwrite default styles, just pass the styles in ResizingPane.

Things to Avoid

  • Don't pass height and width as styles in ResizingPane. If you want to set a default height and width, pass it as props.
  • While passing height and width props, don't use any css unit. Calculations are done on simple numbers, which are then represented as pixel values.
  • Don't use storageConfig prop without storageId prop. storageId prop gives an unique id to each ResizingPane and the dimensions are saved with respect to this given id.
  • Don't change the default position style. This will break the component.