4.0.48 ā€¢ Published 2 days ago

resizable-panes-react v4.0.48

Weekly downloads
-
License
ISC
Repository
github
Last release
2 days ago

This library is highly customizable and can be used in various applications where flexible layout management is required.

resizable-panes-react Cypress Tests nycrc config on GitHub NPM Version npm bundle size Quality Gate Status

Cypress Recoreded tests are available here

Key Features

  • Smooth Resizing: Enjoy smooth and fast pane resizing without performance issues.

  • No Unnecessary Rerenders: Child components in the panes won't rerender during resizing, ensuring a seamless experience.

  • Show and Hide Panes: Easily show and hide panes, considering the minimum and maximum size constraints of other panes.

  • Custom Resizers: Customize resizer handles to match your app's design.

  • Unique Resizers: Single Resizer handle can push and pull n number of Panes in forward and backword direction.

  • Responsive: In ratio mode, It adjusts pane sizes responsively to fit in available space, making it perfect for dynamic layouts.

  • Auto-Save Sizes: Pane size and visibility are automatically saved in the browser's memory for consistent layouts across sessions.

Installation

npm i resizable-panes-react --save
# or
yarn add resizable-panes-react

Usage

.bg-slate-500 {
  background-color: rgb(100 116 139);
}
import { Pane, ResizablePanes } from "resizable-panes-react";

function App() {
  return (
    <div
      style={{
        height: "300px",
      }}
    >
      <ResizablePanes uniqueId="uniqueId" vertical resizerClass="bg-slate-500">
        <Pane id="P0" size={1}>
          Your component 1
        </Pane>
        <Pane id="P1" size={2}>
          Your component 2
        </Pane>
        <Pane id="P2" size={3}>
          Your component 3
        </Pane>
      </ResizablePanes>
    </div>
  );
}

šŸ‘‹ Hi there! If you find this project useful or valuable, please consider Sponsoring Its Development or Buy Me a Coffee

šŸš€ By sponsoring, you'll:

Receive Recognition: Sponsors will be prominently displayed on the project's README and other relevant documentation(Doc website).

Influence Roadmap: Your feedback and suggestions will carry significant weight in shaping the project's future direction and features.

šŸ™ Your sponsorship, no matter the size, is greatly appreciated and goes a long way in sustaining this project's growth.

Demo and Docs

ResizablePanes Props

PropTypeDefaultRequiredDescription
uniqueIdstringtrueHelps identify ResizablePanes component.
unmountOnHidebooleantruefalsetrue - Unmounts the child or children of Pane in Hidden state. false - keeps the child or children of Pane in DOM in Hidden state.
classNamestringfalseIt will get attached to ResizablePanes container element.
zippingbooleantruefalseWhen true & Pane's minSize = 0 - If we will push Pane's size bellow zero it will hide resizer also. When true - Resizer will have no effect while resizing
verticalbooleanfalsefalseIt sets the orientation of Panes.
unit'ratio' or 'pixel'ratiofalseIt sets the unit of size of panes.
minMaxUnit'ratio' or 'pixel'ratiofalseIt sets the unit of minSize and maxSize of panes.
visibilityObjectfalseIt accepts a boolean map of Pane Ids visibility.
storageApiObjectfalseIt used to store data across session. It can be localStorage, sessionStorage or any other following the interface of localStorage.
resizerClassstringfalseIt gets applied to the main resizer element in normal state.
activeResizerClassstringfalseIt gets applied to the main resizer element in active state.
resizerReactElementfalseIt will replace the in build resizer.
resizerSizenumber2optionally requiredIt is the size of resizer. If the size of resizer is other than 2px you will have to provide the value.
onResizefunctionfalseIt emits size map of while resizing layout.
onResizeStopfunctionfalseIt emits size map after the layout resizing is complete.
onReadyfunctionfalseIt emits ResizablePanes component's api once it is constructed.
onChangeVisibilityfunctionfalseIt emits visibility map when there is change in visibility. A Pane can have 'visible', 'hidden' or 'zipped' state.

Pane Props

PropTypeDefaultRequiredDescription
idstringtrueHelps identify Pane component.
sizenumbertrueSets the size of Pane.
unmountOnHidebooleanSame behaviour as of ResizablePanes Prop but works for individual Pane.
classNamestringfalseIt will get attached to Pane element.
maxSizenumberInfinityfalseThe maximum size limit of the Pane.
minSizenumber0falseThe minimum size limit of the Pane.
resizerReactElementfalseIt will replace the in build resizer of Pane.
resizerSizenumberOptionally requiredIt is the size of attached Resizer Element. It is required when we have passed resizer prop to the Pane.

Custom Resizer Component (resizer prop of ResizablePanes/Pane)

PropTypeDefaultRequiredDescription
onMouseDownfunctionAttached it to the element that, upon being clicked and dragged, initiates the resizing of the Pane's size.
onTouchStartCaptureAttached it to the element that, upon being clicked and dragged, initiates the resizing of the Pane's size.(Touch devices)
isMouseDownbooleanUse it style you Custom resizer element behavior.

ResizablePanes component api

MethodParamsDescription
restoreIt restores the default view of layout.
setSize(paneId: string, size: number, behaviour: ISetSizeBehaviour)It excepts the positive number. It sets the size of Pane depending upon: 1. Its min and max. 2. min and max of other panes. type ISetSizeBehaviour = 'ratio' / 'buttom_first' / 'top_first'
setVisibilitiesObjectIt sets the visibility of Panes using the Boolean map of id of Panes.
getSizesIt returns the size map object of Ids of Panes
getVisibilitiesIt returns the visibility map object of Ids of Panes
getStateIt return the current state of all Panes.

Demo and Docs

4.0.41

2 days ago

4.0.40

3 days ago

4.0.43

2 days ago

4.0.42

2 days ago

4.0.48

2 days ago

4.0.45

2 days ago

4.0.44

2 days ago

4.0.47

2 days ago

4.0.46

2 days ago

4.0.32

4 days ago

4.0.38

3 days ago

4.0.37

3 days ago

4.0.39

3 days ago

4.0.34

4 days ago

4.0.33

4 days ago

4.0.36

3 days ago

4.0.29

5 days ago

4.0.30

5 days ago

4.0.31

5 days ago

4.0.19

7 days ago

4.0.21

6 days ago

4.0.27

5 days ago

4.0.26

5 days ago

4.0.22

6 days ago

4.0.25

5 days ago

4.0.18

7 days ago

4.0.4

9 days ago

4.0.7

8 days ago

4.0.6

9 days ago

4.0.1

9 days ago

4.0.0

9 days ago

4.0.3

9 days ago

4.0.2

9 days ago

4.0.9

8 days ago

4.0.8

8 days ago

4.0.10

8 days ago

4.0.16

8 days ago

4.0.15

8 days ago

4.0.17

8 days ago

4.0.12

8 days ago

4.0.11

8 days ago

4.0.14

8 days ago

4.0.13

8 days ago

2.0.9

1 month ago

2.0.7

1 month ago

2.0.8

1 month ago

1.0.17

1 month ago

2.0.3

1 month ago

2.0.2

1 month ago

2.0.5

1 month ago

2.0.4

1 month ago

2.0.6

1 month ago

2.0.1

1 month ago

2.0.0

1 month ago

1.0.16

2 months ago

1.0.15

2 months ago

1.0.14

2 months ago

1.0.13

2 months ago

1.0.12

2 months ago

1.0.9

2 months ago

1.0.8

2 months ago

1.0.11

2 months ago

1.0.10

2 months ago

1.0.2

2 months ago

1.0.1

2 months ago

1.0.0

2 months ago

1.0.7

2 months ago

1.0.6

2 months ago

1.0.5

2 months ago

1.0.4

2 months ago

1.0.3

2 months ago

0.9.2

2 months ago

0.9.1

2 months ago

0.9.0

2 months ago

0.8.9

5 months ago

0.8.8

5 months ago

0.8.5

7 months ago

0.8.7

5 months ago

0.8.6

6 months ago

0.8.4

7 months ago

0.8.3

7 months ago

0.8.2

7 months ago

0.8.1

7 months ago

8.0.1

7 months ago

0.8.0

7 months ago

0.7.14

7 months ago

0.7.13

7 months ago

0.7.12

7 months ago

0.7.11

7 months ago

0.7.10

7 months ago

0.7.8

7 months ago

0.7.7

7 months ago

0.7.6

7 months ago

0.7.5

7 months ago

0.7.4

7 months ago

0.7.3

7 months ago

0.7.2

7 months ago

0.7.1

7 months ago

0.7.0

7 months ago

0.6.2

7 months ago

0.6.1

7 months ago

0.6.0

7 months ago

0.5.14

7 months ago

0.5.13

7 months ago

0.5.12

7 months ago

0.5.11

7 months ago

0.5.10

7 months ago

0.5.9

7 months ago

0.5.8

7 months ago

0.5.7

7 months ago

0.5.6

7 months ago

0.5.5

7 months ago

0.5.4

7 months ago

0.5.3

7 months ago

0.5.2

7 months ago

0.5.1

7 months ago

0.5.0

7 months ago

0.4.0

7 months ago

0.3.2

8 months ago

0.3.1

8 months ago

0.3.0

8 months ago

0.2.0

8 months ago

0.1.3

8 months ago

0.1.2

8 months ago

0.1.1

8 months ago

0.1.0

8 months ago

0.0.0

8 months ago