Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@alisowski/react-resizable-panels

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alisowski/react-resizable-panels

React components for resizable panel groups/layouts

  • 0.1.11
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
202
increased by57.81%
Maintainers
1
Weekly downloads
 
Created
Source

react-resizable-panels

React components for resizable panel groups/layouts

import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";

<PanelGroup autoSaveId="example" direction="horizontal">
  <Panel defaultSize={25}>
    <SourcesExplorer />
  </Panel>
  <PanelResizeHandle />
  <Panel>
    <SourceViewer />
  </Panel>
  <PanelResizeHandle />
  <Panel defaultSize={25}>
    <Console />
  </Panel>
</PanelGroup>

If you like this project, 🎉 become a sponsor or ☕ buy me a coffee

Props

PanelGroup

proptypedescription
autoSaveId?stringUnique id used to auto-save group arrangement via localStorage
childrenReactNodeArbitrary React element(s)
className?stringClass name to attach to root element
direction"horizontal" | "vertical"Group orientation
disablePointerEventsDuringResize?boolean = falseDisable pointer events inside Panels during resize 2
id?stringGroup id; falls back to useId when not provided
onLayout?(sizes: number[]) => voidCalled when group layout changes
storage?PanelGroupStorageCustom storage API; defaults to localStorage 1
style?CSSPropertiesCSS style to attach to root element
tagName?string = "div"HTML element tag name for root element

1: Storage API must define the following synchronous methods:

  • getItem: (name:string) => string
  • setItem: (name: string, value: string) => void

2: This behavior is disabled by default because it can interfere with scrollbar styles, but it can be useful in the edge case where a Panel contains an <iframe>

PanelGroup components also expose an imperative API for manual resizing:

methoddescription
setLayout(panelSizes: number[])Resize panel group to the specified panelSizes ([1 - 100, ...]).

Panel

proptypedescription
childrenReactNodeArbitrary React element(s)
className?stringClass name to attach to root element
collapsedSize?number=0Panel should collapse to this size
collapsible?boolean=falsePanel should collapse when resized beyond its minSize
defaultSize?numberInitial size of panel (numeric value between 1-100)
id?stringPanel id (unique within group); falls back to useId when not provided
maxSize?number = 100Maximum allowable size of panel (numeric value between 1-100); defaults to 100
minSize?number = 10Minimum allowable size of panel (numeric value between 1-100); defaults to 10
onCollapse?(collapsed: boolean) => voidCalled when panel is collapsed; collapsed boolean parameter reflecting the new state
onResize?(size: number) => voidCalled when panel is resized; size parameter is a numeric value between 1-100. 1
order?numberOrder of panel within group; required for groups with conditionally rendered panels
style?CSSPropertiesCSS style to attach to root element
tagName?string = "div"HTML element tag name for root element

1: If any Panel has an onResize callback, the order prop should be provided for all Panels.

Panel components also expose an imperative API for manual resizing:

methoddescription
collapse()If panel is collapsible, collapse it fully.
expand()If panel is currently collapsed, expand it to its most recent size.
getCollapsed(): booleanReturns true if the panel is currently collapsed (size === 0).
getSize(): numberReturns the most recently commited size of the panel as a percentage (1 - 100).
resize(percentage: number)Resize panel to the specified percentage (1 - 100).

PanelResizeHandle

proptypedescription
children?ReactNodeCustom drag UI; can be any arbitrary React element(s)
className?stringClass name to attach to root element
disabled?booleanDisable drag handle
id?stringResize handle id (unique within group); falls back to useId when not provided
onDragging?(isDragging: boolean) => voidCalled when group layout changes
style?CSSPropertiesCSS style to attach to root element
tagName?string = "div"HTML element tag name for root element

If you like this project, buy me a coffee.

FAQs

Package last updated on 01 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc