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 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-resizable-panels

v4.24.1

Published

<img src="https://react-resizable-panels.vercel.app/og.png" alt="react-resizable-panels logo" width="400" height="210" />

Readme

react-resizable-panels: React components for resizable layouts: panel groups, grids, and workspaces of tabsets that users can rearrange by dragging tabs.

Support

If you like this project there are several ways to support it:

Installation

Begin by installing the library from NPM:

npm install react-resizable-panels

TypeScript types

TypeScript definitions are included within the published dist folder

FAQs

Frequently asked questions can be found here.

Documentation

Documentation for this project is available at react-resizable-panels.vercel.app.

Components

Cell

A Cell occupies one or more tracks (columns and rows) within a Grid. Cells are resized along with the tracks they occupy.

Cell elements always include the following attributes:

<div data-cell data-testid="cell-id-prop" id="cell-id-prop">

ℹ️ Test id can be used to narrow selection when unit testing.

⚠️ Cell elements must be direct DOM children of their parent Grid elements.

Required props

Optional props

Grid

A Grid arranges resizable Cells in two dimensions. Columns can be resized horizontally and rows can be resized vertically; dragging the point where a column boundary and a row boundary intersect resizes both.

Size constraints (e.g. min/max size, collapsible) are specified per track (column or row), using the same format as Panel props.

Cells can span multiple columns and/or rows. Track boundaries cannot be resized alongside of a cell that spans across them.

Grid elements always include the following attributes:

<div data-grid data-testid="grid-id-prop" id="grid-id-prop">

ℹ️ Test id can be used to narrow selection when unit testing.

Required props

Optional props

Gridline

Resizes the columns (or rows) of a Grid.

For example:

// Rendered between columns 0 and 1 and spans all rows
<Gridline type="column" column={1} />
// Rendered between rows 0 and 1 and spans all columns
<Gridline type="row" row={1} />
// Rendered between columns 0 and 1 alongside of row 2 only
<Gridline type="column" column={1} row={2} rowSpan={1} />

A gridline should not be rendered alongside of a Cell that spans across its boundary (this includes disabled gridlines; in development builds, an error will be logged to the console); render multiple gridlines along the same boundary instead (e.g. before and after the spanning Cell).

ℹ️ Once a boundary contains a gridline, it can only be resized using gridlines; the parts of the boundary that aren't alongside of a gridline can't be dragged.

Where column and row gridlines intersect, dragging resizes both axes.

Gridlines are not required but they are recommended as they improve keyboard accessibility.

Gridline elements always include the following attributes:

<div aria-orientation="vertical" data-separator role="separator">

ℹ️ Column gridlines are vertical (aria-orientation="vertical") and row gridlines are horizontal (aria-orientation="horizontal").

ℹ️ In addition to the attributes shown above, gridlines also render all required WAI-ARIA properties.

⚠️ Gridline elements must be direct DOM children of their parent Grid elements.

ℹ️ Gridlines rendered by another component (rather than directly within the Grid) aren't detected until they mount, so server-rendered layouts may shift slightly during hydration.

Required props

Optional props

Group

A Group wraps a set of resizable Panel components. Group content can be resized horizontally or vertically.

Group elements always include the following attributes:

<div data-group data-testid="group-id-prop" id="group-id-prop">

ℹ️ Test id can be used to narrow selection when unit testing.

Required props

None

Optional props

Panel

A Panel wraps resizable content and can be configured with min/max size constraints and collapsible behavior.

Panel size props can be in the following formats:

  • Percentage of the parent Group (0..100)
  • Pixels
  • Relative font units (em, rem)
  • Viewport relative units (vh, vw)

ℹ️ Numeric values are assumed to be pixels. Strings without explicit units are assumed to be percentages (0%..100%). Percentages may also be specified as strings ending with "%" (e.g. "33%") Pixels may also be specified as strings ending with the unit "px". Other units should be specified as strings ending with their CSS property units (e.g. 1rem, 50vh)

Panel elements always include the following attributes:

<div data-panel data-testid="panel-id-prop" id="panel-id-prop">

ℹ️ Test id can be used to narrow selection when unit testing.

⚠️ Panel elements must be direct DOM children of their parent Group elements.

Required props

None

Optional props

Separator

Separators are not required but they are recommended as they improve keyboard accessibility.

⚠️ Separator elements must be direct DOM children of their parent Group elements.

Separator elements always include the following attributes:

<div data-separator data-testid="separator-id-prop" id="separator-id-prop" role="separator">

ℹ️ Test id can be used to narrow selection when unit testing.

ℹ️ In addition to the attributes shown above, separator also renders all required WAI-ARIA properties.

Required props

None

Optional props

TabCloseButton

Closes the tab it is rendered within; render it within the element returned by the Workspace's renderTab prop:

renderTab={(tab, props) => (
  <div {...props}>
    {tab.title}
    <TabCloseButton>×</TabCloseButton>
  </div>
)}

The button renders nothing if closing is disabled (by the tab's disableClose flag or the Workspace's disabled prop). Its content defaults to "×" (e.g. it can be replaced with an icon), and its default aria-label is "Close" followed by the tab's title (or id).

Its children, className, style, and title can also be functions of its state (see TabCloseButtonState):

<TabCloseButton title={({ tabTitle }) => `Close ${tabTitle}`} />

To keep the tab open (e.g. to confirm unsaved changes first), call event.preventDefault() in an onClick handler:

<TabCloseButton
  onClick={(event) => {
    if (hasUnsavedChanges && !confirm("Discard unsaved changes?")) {
      event.preventDefault();
    }
  }}
/>

ℹ️ This button is not focusable by default (tabIndex={-1}), since tabs shouldn't contain focusable content; keyboard users can close the focused tab with Delete or Backspace.

Required props

None

Optional props

TabsetCollapseButton

Collapses (or expands) the tabset it is rendered within; render it within the content returned by the Workspace's renderTabsetToolbar prop. Its children, className, style, and title can be functions of its state (see TabsetCollapseButtonState), e.g. to show a different icon while the tabset is collapsed:

renderTabsetToolbar={() => (
  <TabsetCollapseButton title={({ isCollapsed }) => (isCollapsed ? "Expand" : "Collapse")}>
    {({ isCollapsed }) => (isCollapsed ? "▸" : "▾")}
  </TabsetCollapseButton>
)}

The button renders nothing if the tabset can't be collapsed (see ParentTabsetState.isCollapsible), or while it's maximized. While the tabset is collapsed only because it doesn't fit (see ParentTabsetState.isCollapsedToFit), it can't be expanded, so the button has aria-disabled="true".

Its aria-expanded attribute reflects whether the tabset is expanded, and its aria-controls attribute refers to the selected tab's panel; its default aria-label ("Collapse tabset") doesn't change, since aria-expanded describes the state.

To keep the tabset as it is, call event.preventDefault() in an onClick handler.

ℹ️ Clicking a tab of a collapsed tabset also expands it (unless the workspace is disabled, which doesn't restrict this button).

Required props

None

Optional props

TabsetDragHandle

Drags the tabset it is rendered within; render it within the content returned by the Workspace's renderTabsetToolbar prop:

renderTabsetToolbar={() => (
  <TabsetDragHandle>⠿</TabsetDragHandle>
)}

By default, a tabset is dragged by the empty space in its header; once its header contains a drag handle, only the handle drags it. Any element with a data-tabset-drag-handle attribute is a drag handle; this component also sets touch-action: none, so that it can be dragged by touch.

The handle has a data-disabled attribute when the tabset can't be dragged (see useParentTabsetState), e.g. to hide it. Its children, className, style, and title can also be functions of its state (see TabsetDragHandleState):

<TabsetDragHandle title={({ isDisabled }) => (isDisabled ? undefined : "Drag tabset")}>
  ⠿
</TabsetDragHandle>

Required props

None

Optional props

TabsetMaximizeButton

Maximizes (or restores) the tabset it is rendered within; render it within the content returned by the Workspace's renderTabsetToolbar prop. Its children, className, style, and title can be functions of its state (see TabsetMaximizeButtonState), e.g. to show a different icon while the tabset is maximized:

renderTabsetToolbar={() => (
  <TabsetMaximizeButton title={({ isMaximized }) => (isMaximized ? "Restore" : "Maximize")}>
    {({ isMaximized }) => (isMaximized ? "Restore" : "Maximize")}
  </TabsetMaximizeButton>
)}

The button renders nothing for the only tabset in a workspace (see ParentTabsetState.isRoot) and for floating tabsets, which can't be maximized.

Its aria-pressed attribute reflects whether the tabset is maximized; its default aria-label ("Maximize tabset") doesn't change, since aria-pressed describes the state.

To keep the tabset as it is, call event.preventDefault() in an onClick handler.

Required props

None

Optional props

Workspace

A Workspace arranges tabsets that users can rearrange by dragging tabs: between tabsets, within a tabset's list of tabs, or onto the edge of a tabset to split it. Tabsets can be resized and maximized.

The layout is described by a serializable model (see WorkspaceModel). Workspaces are uncontrolled: provide an initial model with the defaultModel prop, save changes from the onModelChanged callback, and make changes using the imperative API (see WorkspaceImperativeHandle).

ℹ️ Tab content is not remounted when a tab is moved, and its browser state (e.g. iframes, playing media, and focus) is preserved where possible; browsers that don't support moveBefore (e.g. Safari) reset some of that state (e.g. iframes are reloaded).

Workspace elements always include the following attributes:

<div data-workspace data-testid="workspace-id-prop" id="workspace-id-prop">

ℹ️ Test id can be used to narrow selection when unit testing.

Required props

Optional props

Imperative APIs

GridImperativeHandle

Imperative Grid API.

ℹ️ The useGridRef and useGridCallbackRef hooks are exported for convenience in TypeScript projects.

Methods

GridTrackImperativeHandle

Imperative API for an individual Grid track (column or row); returned by GridImperativeHandle.getTrackById and GridImperativeHandle.getTrackByIndex.

ℹ️ Sizes are relative to the space available to the track's axis (e.g. the width of the Grid, minus gaps and gridlines, for a column).

Methods