{"id":13400557,"url":"https://github.com/bokuweb/react-sortable-pane","last_synced_at":"2025-05-15T08:08:59.835Z","repository":{"id":47609806,"uuid":"49751298","full_name":"bokuweb/react-sortable-pane","owner":"bokuweb","description":":sparkles: A sortable and resizable pane component for React.","archived":false,"fork":false,"pushed_at":"2025-04-11T15:42:42.000Z","size":7192,"stargazers_count":650,"open_issues_count":35,"forks_count":49,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-04-14T12:18:27.780Z","etag":null,"topics":["pane","react","sortable"],"latest_commit_sha":null,"homepage":"http://bokuweb.github.io/react-sortable-pane","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bokuweb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["bokuweb"]}},"created_at":"2016-01-15T23:51:01.000Z","updated_at":"2025-03-21T03:23:09.000Z","dependencies_parsed_at":"2023-01-22T01:16:03.997Z","dependency_job_id":"64e9f183-d15f-469e-8976-8bd179b47fbf","html_url":"https://github.com/bokuweb/react-sortable-pane","commit_stats":{"total_commits":328,"total_committers":20,"mean_commits":16.4,"dds":"0.45731707317073167","last_synced_commit":"46df4bae1f0cf44952dc5521c4fb9e11625c096e"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bokuweb%2Freact-sortable-pane","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bokuweb%2Freact-sortable-pane/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bokuweb%2Freact-sortable-pane/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bokuweb%2Freact-sortable-pane/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bokuweb","download_url":"https://codeload.github.com/bokuweb/react-sortable-pane/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248877968,"owners_count":21176244,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pane","react","sortable"],"created_at":"2024-07-30T19:00:53.287Z","updated_at":"2025-04-14T12:18:31.898Z","avatar_url":"https://github.com/bokuweb.png","language":"TypeScript","readme":"\u003cp align=\"center\"\u003e\u003cimg src =\"https://github.com/bokuweb/react-sortable-pane/blob/master/logo.png?raw=true\" /\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003eSortable and resizable pane component for react.\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://circleci.com/gh/bokuweb/react-sortable-pane\"\u003e\n\u003cimg src=\"https://circleci.com/gh/bokuweb/react-sortable-pane/tree/master.svg?style=svg\" alt=\"CircleCI\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/package/react-sortable-pane\"\u003e\n\u003cimg src=\"https://img.shields.io/npm/v/react-sortable-pane.svg\" alt=\"Build Status\" /\u003e\u003c/a\u003e \n\u003ca href=\"https://www.npmjs.com/package/react-sortable-pane\"\u003e\n\u003cimg src=\"https://img.shields.io/npm/dm/react-sortable-pane.svg\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://renovatebot.com/\"\u003e\n\u003cimg src=\"https://img.shields.io/badge/renovate-enabled-brightgreen.svg\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/prettier/prettier\"\u003e\n\u003cimg src=\"https://img.shields.io/badge/styled_with-prettier-ff69b4.svg\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## Table of Contents\n\n- [Screenshot](#Screenshot)\n- [Live Demo](#live-demo)\n  - [Storybook](#storybook)\n  - [CodeSandbox](#codesandbox)\n- [Install](#install)\n- [Usage](#usage)\n  - [uncontrolled](#uncontrolled)\n  - [controlled](#controlled)\n- [Props](#props)\n  - [SortablePaneComponent](#sortablepanecomponent)\n  - [PaneComponent](#panecomponent)\n- [Test](#test)\n- [Changelog](#changelog)\n- [License](#license)\n\n## Screenshot\n\n![screenshot](https://raw.githubusercontent.com/bokuweb/react-sortable-pane/master/screenshot/screenshot.gif)\n\n## Live Demo\n\n### Storybook\n\n[Storybook](http://bokuweb.github.io/react-sortable-pane/)\n\n### CodeSandbox\n\n[CodeSandbox(Uncontrolled)](https://codesandbox.io/s/oj4o9763y9)\n\n## Install\n\n```sh\nnpm i react-sortable-pane\n```\n\nor\n\n```sh\nyarn add react-sortable-pane\n```\n\n## Usage\n\n### Uncontrolled\n\nIf you need not to control `SortablePane` state, please use `defaultSize` and `defaultOrder`.\n\n```typescript\nimport * as React from 'react';\nimport { SortablePane, Pane } from 'react-sortable-pane';\n\nexport default function SimpleUncontrolledExample() {\n  const panes = [0, 1, 2].map(key =\u003e (\n    \u003cPane key={key} defaultSize={{ width: '100%', height: 120 }}\u003e\n      00{key}\n    \u003c/Pane\u003e\n  ));\n  return (\n    \u003cdiv\u003e\n      \u003cSortablePane direction=\"vertical\" margin={20} defaultOrder={['0', '1', '2']}\u003e\n        {panes}\n      \u003c/SortablePane\u003e\n    \u003c/div\u003e\n  );\n}\n```\n\n### Controlled\n\nIf you need to control `SortablePane`state by yourself, please use `size` and `order`.\n\n```typescript\nimport * as React from 'react';\nimport { SortablePane, Pane } from 'react-sortable-pane';\n\ntype State = {\n  order: string[];\n  panes: { [key: string]: { height: number } };\n};\n\nexport default class SimpleControlledFullExample extends React.Component\u003c{}, State\u003e {\n  state = {\n    order: ['2', '1', '0'],\n    panes: { '0': { height: 100 }, '1': { height: 200 }, '2': { height: 300 } },\n  };\n\n  render() {\n    const panes = [0, 1, 2].map(key =\u003e (\n      \u003cPane key={key} size={{ width: '100%', height: this.state.panes[key].height }}\u003e\n        00{key}\n      \u003c/Pane\u003e\n    ));\n    return (\n      \u003cdiv\u003e\n        \u003cSortablePane\n          direction=\"vertical\"\n          margin={20}\n          order={this.state.order}\n          onOrderChange={order =\u003e {\n            this.setState({ order });\n          }}\n          onResizeStop={(e, key, dir, ref, d) =\u003e {\n            this.setState({\n              panes: { ...this.state.panes, [key]: { height: this.state.panes[key].height + d.height } },\n            });\n          }}\n        \u003e\n          {panes}\n        \u003c/SortablePane\u003e\n      \u003c/div\u003e\n    );\n  }\n}\n```\n\n## Props\n\n### SortablePaneComponent\n\n| Props                | Required | Type                                                                                                                                  | Default              | Description                                                                                                                                                          |\n|:---------------------|:---------|:--------------------------------------------------------------------------------------------------------------------------------------|:---------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `className`          |          |`string`                                                                                                                               | `undefined`          | Specify `className` of component.                                                                                                                                    | \n| `style`              |          |`React.CssProperties`                                                                                                                  | `{}`                 | Original style of component.                                                                                                                                         |        \n| `direction`          |          |\u003ccode\u003e'horizontal' \u0026#124; 'vertical'\u003c/code\u003e                                                                                            | `horizontal`         | The `direction` is used to set the direction of a component.                                                                                                         |\n| `order`              |          |`string[]`                                                                                                                             | `undefined`          | The `order` is used to control `Pane` order. If you need not to control `Pane` state, you can omit this property. (See also, [controlled](#controlled))              |\n| `defaultOrder`       |          |`string[]`                                                                                                                             | `undefined`          | The `defaultOrder` is used to set default `Pane` order. If you need to control `Pane` state, please use `order` property. (See also, [uncontrolled](#uncontrolled))  |\n| `margin`             |          |`number`                                                                                                                               | `0`                  | The `margin` is used to set the margin between `Pane` component.                                                                                                     |\n| `isSortable`         |          |`boolean`                                                                                                                              | `true`               | The `isSortable` is used to control whether panes can be dragged or not.                                                                                             |\n| `disableEffect`      |          |`boolean`                                                                                                                              | `false`              | The `disableEffect` is used to disable floating effect.                                                                                                              |\n| `dragHandleClassName`|          |`string`                                                                                                                               | `undefined`          | The `dragHandleClassName` is a class name of an element which should handle drag events for panes.                                                                   | \n| `onOrderChange`      |          |`(order: string[]) =\u003e void`                                                                                                            | `undefined`          | It is called when `Pane` component order changed. The argument `order` is array of react element's `key`.                                                            |\n| `onResizeStart`      |          |\u003ccode\u003e(e: React.MouseEvent \u0026#124; React.TouchEvent, key: string, dir: PaneResizeDirection) =\u003e void\u003c/code\u003e                              | `undefined`          | It is called when `Pane` component resize start.                                                                                                                     |\n| `onResize`           |          |\u003ccode\u003e(e: MouseEvent \u0026#124; TouchEvent, key: string, dir: PaneResizeDirection, elementRef: HTMLElement, delta: PaneSize) =\u003e void\u003c/code\u003e| `undefined`          | It is called when `Pane` component resize.                                                                                                                           |\n| `onResizeStop`       |          |\u003ccode\u003e(e: MouseEvent \u0026#124; TouchEvent, key: string, dir: PaneResizeDirection, elementRef: HTMLElement, delta: PaneSize) =\u003e void\u003c/code\u003e| `undefined`          | It is called when `Pane` component resize stop.                                                                                                                      |\n| `onDragStart`        |          |\u003ccode\u003e(e: React.MouseEvent\u003cHTMLElement\u003e \u0026#124; React.TouchEvent\u003cHTMLElement\u003e,  key: string, elementRef: HTMLElement) =\u003e void\u003c/code\u003e    | `undefined`          | It is called when `Pane` component dragging starts.                                                                                                                  |\n| `onDragStop`         |          |\u003ccode\u003e(e: MouseEvent \u0026#124; TouchEvent, key: PaneKey, elementRef: HTMLElement, order: string[]) =\u003e void\u003c/code\u003e                                          | `undefined`          | It is called when `Pane` component dragging stop.                                                                                                                    |\n\n## PaneComponent\n\n| Props                | Required | Type                                                                                                                  | Default                           | Description                                                                                                                                                          |\n|:---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------|:----------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `className`          |          |`string`                                                                                                               | `undefined`                       | Specify `className` of component.                                                                                                                                    | \n| `style`              |          |`React.CssProperties`                                                                                                  | `{}`                              | Original style of component.                                                                                                                                         |        \n| `defaultSize`        |          |\u003ccode\u003e{ width?: (number \u0026#124; string), height?: (number \u0026#124; string) }\u003c/code\u003e                                       | `auto`                            | Specifies the width and height that the dragged item should start at. For example, you can set 300, '300px', 50%.                                                    |                                                                                                                                   \n| `size`               |          |\u003ccode\u003e{ width?: (number \u0026#124; string), height?: (number \u0026#124; string) }\u003c/code\u003e                                       | `auto`                            | The size property is used to set the size of the component. For example, you can set 300, '300px', '50%'.                                                            |                                                                                                                \n| `minWidth`           |          |\u003ccode\u003enumber \u0026#124; string\u003c/code\u003e                                                                                                 | `10px`                            | The `minWidth` is used to set the minimum width of a Pane component.                                                                                                 |\n| `minHeight`          |          |\u003ccode\u003enumber \u0026#124; string\u003c/code\u003e                                                                                                 | `10px`                            | The `minHeight` is used to set the minimum height of a Pane component.                                                                                               |\n| `maxWidth`           |          |\u003ccode\u003enumber \u0026#124; string\u003c/code\u003e                                                                                                 | `undefined`                       | The `maxWidth` is used to set the maximum width of a Pane component.                                                                                                 |\n| `maxHeight`          |          |\u003ccode\u003enumber \u0026#124; string\u003c/code\u003e                                                                                                 | `undefined`                       | The `maxHeight` is used to set the maximum height of a Pane component.                                                                                               |\n| `grid`               |          |`[number, number]`                                                                                                     | `[1, 1]`                          | The `maxHeight` is used to set the maximum height of a Pane component.                                                                                               |\n| `resizable`          |          |`{ x: boolean, y: boolean, xy: boolean }`                                                                              | `{ x: true, y: true, xy: true }`  | The `resizable` is used to set the resizable permission of a component.                                                                                            |\n\n## Changelog\n\n### V1.0.2\n\n- fix: Fixed a bug, order offset calculation doesn't work properly #203\n\n### V1.0.1\n\n- fix: Add `flowtype` definition.\n\n### V1.0.0\n\n- chore: Update deps.\n\n### V1.0.0-beta.2\n\n- fix: fixed a min / max size types.\n\n### V1.0.0-beta.1\n\n- fix: fixed a TouchEvent error in IE11.\n\n### V1.0.0-beta.0\n\n- feat: Use `TypeScript` instead of `flowtype`.\n- feat: Add `defaultSize`, `defaultOrder`, `order`, `size` props to control(or uncontrol) `SortablePane` state. \n- fix: Some tiny bugs.\n- chore: Add some stories.\n\n### V0.8.2\n\n- chore: update deps.\n\n### V0.8.1\n\n- fix: add hysteresis and fix sort position\n- fix: add mouseleave to panes node\n\n### V0.8.0\n\n- fix: remove unused `order` property.\n- fix: fix position when parent element resized.\n- chore: update deps.\n\n### V0.7.1\n\n- fix: sort, Drag, Resize does not work in Safari #128\n\n### V0.7.0\n\n- chore: update deps (use `re-resizable` instead of `react-resizable-box`)\n\n### V0.6.8\n\n- Feature: Add `grid` props.\n\n### V0.6.7\n\n- Chore: Upgrade dependencies.\n\n### V0.6.6\n\n- Add `grid` props. (#93)\n\n### V0.6.5\n\n- Update README.\n\n### V0.6.4\n\n- Fix Bug, `onResizeStart` and `onResizeStop` not fired.\n\n### V0.6.2\n\n- Use flowtype\n- Use rollup\n- Change callback I/F\n\n### V0.5.5\n\n- Use `prop-types` package.\n- Fix #56 thanks @avaskys.\n\n### V0.5.4\n\n- Support server side rendering. #50 thanks @lazreg87\n\n### V0.5.3\n\n- Fix componentDidUpdate argument, use this.props instaead of prev.\n\n### V0.5.2\n\n- Use babel-preset-es2015-ie babel-preset-es2015-ie #47 thanks @PabloDiablo\n\n### V0.5.1\n\n- update readme\n\n### V0.5.0\n\n- Fixes a nasty bug\n- Add isResizable props to Pane component\n- Set `user-select: none` when resizeing or moving.\n- Add zIndex props.\n- update example\n\n### V0.4.1\n\n- Fixes a nasty bug where all Panes could end up sharing the same static style #44 (thanks @ara4n)\n\n### V0.4.0\n\n- Add Object.assign transform plugin\n- Add add-module-exports plugin\n\n### V0.3.2\n\n- Allow strings for width and height. (thanks @lanVS)\n- Add onDragStart and onDragEnd props. (thanks @lanVS)\n\n### V0.3.1\n\n- Add `isSortable` props. (#34 thanks @lanVS)\n\n### V0.3.0\n\n- Change sort trigger position (#40 thanks @lanVS)\n\n### V0.2.12\n\n- Update react-motion(use \"^0.4.3\")\n\n### V0.2.10, V0.2.11\n\n- Fix order update bug\n\n### V0.2.8\n\n- Fix size updater bug\n\n### V0.2.7\n\n- Fix size updater bug\n\n### V0.2.6\n\n- Fix order bug\n- Update react-resizable-box(^1.2.0)\n\n### V0.2.5\n\n- Add order props to change order by parent component.\n- Add husky and pre push hook.\n\n### V0.2.4\n\n- update packages to support react v15\n\n### V0.2.3\n\n- update pane size when props.width/height updated.\n\n### V0.2.2\n\n- Fix className bug.\n\n### V0.2.1\n\n- Update resizable box component.\n\n### V0.2.0\n\n- Support pane append and remove.\n- Support vertical mode.\n- Fix pane size calculator.\n\n### V0.1.2\n\n- Add onOrderChange callback.\n- Add disableEffect props.\n- Fix eslint error.\n\n### V0.1.1\n\n- Add onResize callback.\n\n### V0.1.0\n\npublised.\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2018 @bokuweb\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","funding_links":["https://github.com/sponsors/bokuweb"],"categories":["UI Components","Uncategorized","Demos","\u003csummary\u003eUI Components\u003c/summary\u003e","TypeScript","React [🔝](#readme)"],"sub_categories":["Form Components","Uncategorized","Device Input/User Action"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbokuweb%2Freact-sortable-pane","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbokuweb%2Freact-sortable-pane","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbokuweb%2Freact-sortable-pane/lists"}