Skip to content
All components
Data display

Resizable

Split a region into adjacent panes that people can resize with a pointer or the keyboard, within the minimum and maximum sizes you set.

Split panes the user can drag.

Installation

tdpxl is not an npm dependency of your app. The @tdpxl/cli command (not published to npm yet) copies the source into your project, with the registry items and npm packages it imports.

npx @tdpxl/cli add resizable

Then import it from @/components/ui/resizable. New project? Start with the installation guide.

Examples

Each example is one branch of the official demo, rendered in its own frame. The code is that branch as you would write it, with imports pointing at the default install paths.

Vertical split

Split panes vertically with minimum sizes. The handle moves with Up and Down arrows and stops at each pane's minimum. Preserves the complete example's required parts, labels and providers. The example's local state remains owned by that composition.

"use client"

import {
  ResizableHandle,
  ResizablePanel,
  ResizablePanelGroup,
} from "@/components/ui/resizable"

export function ResizableVerticalSplit() {
  return (
    <div className="flex w-full max-w-2xl flex-col gap-10">
      <ResizablePanelGroup
        orientation="vertical"
        className="h-72 w-full max-w-lg overflow-hidden rounded-16 border border-soft-200"
      >
        <ResizablePanel defaultSize="65%" minSize="30%">
          <div className="flex h-full flex-col gap-1 p-4">
            <p className="text-label-sm text-strong-950">Editor</p>
            <p className="text-paragraph-sm text-sub-600">Drag the bar or use the arrow keys to give the output more room.</p>
          </div>
        </ResizablePanel>
        <ResizableHandle withHandle aria-label="Resize output panel" />
        <ResizablePanel minSize="20%">
          <div className="flex h-full flex-col gap-1 p-4">
            <p className="text-label-sm text-strong-950">Output</p>
            <p className="font-mono text-paragraph-sm text-sub-600">3 checks passed in 1.2 s</p>
          </div>
        </ResizablePanel>
      </ResizablePanelGroup>
    </div>
  )
}

Three panes

Resize three panes with pixel and percentage limits. Numbers are pixels and strings are percentages; every handle has its own name. Preserves the complete example's required parts, labels and providers. The example's local state remains owned by that composition.

"use client"

import {
  ResizableHandle,
  ResizablePanel,
  ResizablePanelGroup,
} from "@/components/ui/resizable"

const folders = ["Inbox", "Drafts", "Sent", "Archive"]

export function ResizableThreePanes() {
  return (
    <div className="flex w-full max-w-2xl flex-col gap-10">
      <ResizablePanelGroup
        orientation="horizontal"
        className="h-64 w-full overflow-hidden rounded-16 border border-soft-200"
      >
        <ResizablePanel defaultSize="22%" minSize={120} maxSize="35%">
          <nav aria-label="Mail folders" className="h-full p-3">
            <ul className="flex flex-col gap-1 text-label-sm text-strong-950">
              {folders.map((folder) => (
                <li key={folder}>
                  <a href={`#${folder.toLowerCase()}`} className="block truncate rounded-8 px-2 py-1.5 hover:bg-weak-50">
                    {folder}
                  </a>
                </li>
              ))}
            </ul>
          </nav>
        </ResizablePanel>
        <ResizableHandle aria-label="Resize folder list" />
        <ResizablePanel defaultSize="33%" minSize={160}>
          <div className="h-full p-3 text-paragraph-sm text-sub-600">12 conversations</div>
        </ResizablePanel>
        <ResizableHandle aria-label="Resize conversation list" />
        <ResizablePanel minSize="30%">
          <div className="h-full p-3 text-paragraph-sm text-sub-600">Select a conversation to read it.</div>
        </ResizablePanel>
      </ResizablePanelGroup>
    </div>
  )
}

Collapsible panel

Collapse a panel completely from its handle. Enter on the focused handle collapses or restores the panel; collapsed content becomes inert. Preserves the complete example's required parts, labels and providers. The example's local state remains owned by that composition.

"use client"

import {
  ResizableHandle,
  ResizablePanel,
  ResizablePanelGroup,
} from "@/components/ui/resizable"

export function ResizableCollapsiblePanel() {
  return (
    <div className="flex w-full max-w-2xl flex-col gap-10">
      <ResizablePanelGroup
        orientation="horizontal"
        className="h-48 w-full max-w-lg overflow-hidden rounded-16 border border-soft-200"
      >
        <ResizablePanel id="details" defaultSize="35%" minSize="25%" collapsible collapsedSize="0%">
          <div className="flex h-full flex-col gap-1 p-4">
            <p className="text-label-sm text-strong-950">Details</p>
            <p className="text-paragraph-sm text-sub-600">Focus the handle and press Enter to collapse or restore this panel.</p>
          </div>
        </ResizablePanel>
        <ResizableHandle withHandle aria-label="Resize details panel" />
        <ResizablePanel id="preview" minSize="40%">
          <div className="flex h-full items-center justify-center p-4 text-label-sm text-sub-600">
            Preview
          </div>
        </ResizablePanel>
      </ResizablePanelGroup>
    </div>
  )
}

Stack on small screens

Replace the split with stacked content on small screens. Narrow layouts show both panes one after the other instead of offering a cramped resize handle. Preserves the complete example's required parts, labels and providers. The example's local state remains owned by that composition.

"use client"

import {
  ResizableHandle,
  ResizablePanel,
  ResizablePanelGroup,
} from "@/components/ui/resizable"

export function ResizableStackOnSmallScreens() {
  return (
    <div className="flex w-full max-w-2xl flex-col gap-10">
      <div className="w-full max-w-lg">
        <div className="hidden md:block">
          <ResizablePanelGroup
            orientation="horizontal"
            className="h-48 w-full overflow-hidden rounded-16 border border-soft-200"
          >
            <ResizablePanel defaultSize="50%" minSize="30%">
              <div className="flex h-full items-center justify-center p-4 text-label-sm text-sub-600">
                Original text
              </div>
            </ResizablePanel>
            <ResizableHandle withHandle aria-label="Resize comparison" />
            <ResizablePanel minSize="30%">
              <div className="flex h-full items-center justify-center p-4 text-label-sm text-sub-600">
                Translation
              </div>
            </ResizablePanel>
          </ResizablePanelGroup>
        </div>
        <div className="flex flex-col gap-3 md:hidden">
          <div className="rounded-16 border border-soft-200 p-4 text-label-sm text-sub-600">Original text</div>
          <div className="rounded-16 border border-soft-200 p-4 text-label-sm text-sub-600">Translation</div>
        </div>
      </div>
    </div>
  )
}

API reference

Generated from the component's TypeScript signatures. Inherited DOM and primitive props are listed separately.

ResizableHandle

Let users adjust the relative size of adjacent panes.

ResizableHandle props
PropTypeDefaultDescription
styleReact.CSSProperties | undefined—CSS properties. ℹ️ Use the data-separator attribute for custom _hover_ and _active_ styles ⚠️ The following properties cannot be overridden: flex-grow, flex-shrink
classNamestring | undefined—CSS class name. ℹ️ Use the data-separator attribute for custom _hover_ and _active_ styles ⚠️ The following properties cannot be overridden: flex-grow, flex-shrink
idstring | undefined—Uniquely identifies the separator within the parent group. Falls back to useId when not provided. ℹ️ This value will also be assigned to the id and data-testid attributes; (an explicit data-testid prop will take precedence).
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
disabledboolean | undefined—When disabled, the separator cannot be used to resize its neighboring panels. ℹ️ The panels may still be resized indirectly (while other panels are being resized). To prevent a panel from being resized at all, it needs to also be disabled.
disableDoubleClickboolean | undefined—When true, double-clicking this Separator will not reset its Panel to its default size.
elementRefReact.Ref<HTMLDivElement> | undefined—Ref attached to the root HTMLDivElement.
previewReact.ReactNode—Overrides the Group default preview for this Separator when resizePreviewMode is "separator".
withHandleboolean | undefined—Render the visible grip inside the resize separator. It changes appearance, not the panel group's resize API.
Inherited props (9)
ResizableHandle inherited props
PropTypeDefaultDescription
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLDivElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

ResizablePanel

The ResizablePanel part of resizable. Use it with the complete source composition and preserve its required parent context.

ResizablePanel props
PropTypeDefaultDescription
styleReact.CSSProperties | undefined—CSS properties. ⚠️ The default inline styles cannot be overridden, except for [overflow](https://react-resizable-panels.vercel.app/examples/overflow).
classNamestring | undefined—CSS class name. ⚠️ Class is applied to nested HTMLDivElement to avoid styles that interfere with Flex layout.
idstring | undefined—Uniquely identifies this panel within the parent group. Falls back to useId when not provided. ℹ️ This prop is used to associate persisted group layouts with the original panel. ℹ️ This value will also be assigned to the id and data-testid attributes; (an explicit data-testid prop will take precedence).
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
collapsedSizestring | number | undefined—Panel size when collapsed; defaults to 0%.
collapsedThresholdstring | number | undefined—Distance a collapsible panel must be resized past its minSize to collapse, or past its collapsedSize to expand. Defaults to half the distance between collapsedSize and minSize. For example if a panel declares collapsedSize="5%", collapsedThreshold="5%", and minSize="25%", it will collapse when resized below 20% and expand when resized above 10%. ℹ️ Interpretation rules: - Numbers are interpreted as pixels (e.g. minSize={200} is 200 pixels) - Strings without explicit units are interpreted as percentage (e.g. minSize="50" is 50 percent) - Use explicit units (e.g. "px", "%", "em", "rem", "vh", or "vw") to change interpretation
collapsibleboolean | undefined—This panel can be collapsed. ℹ️ A collapsible panel will collapse when its size is less than the specified minSize
defaultSizestring | number | undefined—Default size of Panel within its parent group; default is auto-assigned based on the total number of Panels. ℹ️ Interpretation rules: - Numbers are interpreted as pixels (e.g. defaultSize={200} is 200 pixels) - Strings without explicit units are interpreted as percentage (e.g. defaultSize="50" is 50 percent) - Use explicit units (e.g. "px", "%", "em", "rem", "vh", or "vw") to change interpretation ⚠️ Percentage based sizes may cause slight layout shift when server-rendering. For more information see the documentation.
disabledboolean | undefined—When disabled, a panel cannot be resized either directly or indirectly (by resizing another panel).
elementRefReact.Ref<HTMLDivElement | null> | undefined—Ref attached to the root HTMLDivElement.
groupResizeBehavior"preserve-relative-size" | "preserve-pixel-size" | undefined—How should this Panel behave if the parent Group is resized? Defaults to preserve-relative-size. - preserve-relative-size: Retain the current relative size (as a percentage of the Group) - preserve-pixel-size: Retain its current size (in pixels) ℹ️ Panel min/max size constraints may impact this behavior. ⚠️ A Group must contain at least one Panel with preserve-relative-size resize behavior.
maxSizestring | number | undefined—Maximum size of Panel within its parent group; defaults to "100%". ℹ️ Interpretation rules: - Numbers are interpreted as pixels (e.g. maxSize={200} is 200 pixels) - Strings without explicit units are interpreted as percentage (e.g. maxSize="50" is 50 percent) - Use explicit units (e.g. "px", "%", "em", "rem", "vh", or "vw") to change interpretation
minSizestring | number | undefined—Minimum size of Panel within its parent group; defaults to 0%. ℹ️ Interpretation rules: - Numbers are interpreted as pixels (e.g. minSize={200} is 200 pixels) - Strings without explicit units are interpreted as percentage (e.g. minSize="50" is 50 percent) - Use explicit units (e.g. "px", "%", "em", "rem", "vh", or "vw") to change interpretation
panelRefReact.Ref<import("react-resizable-panels").PanelImperativeHandle | null> | undefined—Exposes the following imperative API: - collapse(): void - expand(): void - getSize(): PanelSize - isCollapsed(): boolean - resize(size: number | string): void ℹ️ The usePanelRef and usePanelCallbackRef hooks are exported for convenience use in TypeScript projects.
Inherited props (10)
ResizablePanel inherited props
PropTypeDefaultDescription
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLDivElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

ResizablePanelGroup

Group related parts while preserving the parent component's required composition.

ResizablePanelGroup props
PropTypeDefaultDescription
classNamestring | undefined—CSS class name.
idstring | undefined—Uniquely identifies this group within an application. Falls back to useId when not provided. ℹ️ This value will also be assigned to the id and data-testid attributes; (an explicit data-testid prop will take precedence).
styleReact.CSSProperties | undefined—CSS properties. ⚠️ The default inline styles cannot be overridden, except for [overflow](https://react-resizable-panels.vercel.app/examples/overflow).
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Panel and Separator components that comprise this group.
defaultLayoutimport("react-resizable-panels").Layout | undefined—Default layout for the Group. ℹ️ This value allows layouts to be remembered between page reloads. ⚠️ Slight layout shift may occur when server-rendering panels with percentage-based default sizes. Refer to the documentation for suggestions on how to minimize the impact of this.
disableCursorboolean | undefined—This library sets custom mouse cursor styles to indicate drag state. Use this prop to disable that behavior for Panels and Separators in this group.
disabledboolean | undefined—Disable resize functionality.
elementRefReact.Ref<HTMLDivElement | null> | undefined—Ref attached to the root HTMLDivElement.
groupRefReact.Ref<import("react-resizable-panels").GroupImperativeHandle | null> | undefined—Exposes the following imperative API: - getLayout(): Layout - setLayout(layout: Layout): Layout ℹ️ The useGroupRef and useGroupCallbackRef hooks are exported for convenience use in TypeScript projects.
resizePreviewMode("separator" | "panel") | undefined—Controls whether pointer dragging updates Panel sizes immediately, or renders overlay separator previews until the pointer is released. Defaults to "panel" (immediate resizing); "separator" defers resizing until release. Customize previews using the SeparatorOverlay component.
resizeTargetMinimumSize{ coarse: number; fine: number; } | undefined—Minimum size of the resizable hit target area (either Separator or Panel edge). This threshold ensures targets are large enough to avoid mis-clicks. - Coarse inputs (typically a finger on a touchscreen) have reduced accuracy; to ensure accessibility and ease of use, hit targets should be larger to prevent mis-clicks. - Fine inputs (typically a mouse) can be smaller ℹ️ [Apple interface guidelines](https://developer.apple.com/design/human-interface-guidelines/accessibility) suggest 20pt (27px) on desktops and 28pt (37px) for touch devices. In practice this seems to be much larger than many of their own applications use though.
orientation"horizontal" | "vertical" | undefined—Specifies the resizable orientation ("horizontal" or "vertical"); defaults to "horizontal"
Inherited props (10)
ResizablePanelGroup inherited props
PropTypeDefaultDescription
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLDivElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

Accessibility & usage

From registry/ui/resizable.meta.json (authored guidance; human review may still be pending). Behavior is checked by Storybook tests, not certified here.

When to use

  • Tool layouts where the right balance depends on the task: editor and preview, list and detail, code and output.
  • A side panel people may want wider, narrower or fully collapsed, with sizes optionally remembered between visits.
  • Desktop-first, pointer-rich interfaces where screen space is plentiful.

When not to use

  • Small screens where two panes cannot both be usable; stack the content or switch views instead.
  • Fixed layouts where no one benefits from adjusting the split.
  • App navigation that opens and closes; use a sidebar or sheet with their own behavior.
  • Showing or hiding a single region; a collapsible is simpler.

Anatomy

ResizablePanelGroup
react-resizable-panels v4 Group: orientation, defaultLayout, onLayoutChange/onLayoutChanged, groupRef (getLayout/setLayout), disabled and resizeTargetMinimumSize.
ResizablePanel
A Panel with defaultSize, minSize, maxSize, collapsible, collapsedSize and onResize (three arguments preserved). Becomes inert while it is zero size; consumer inert is preserved.
ResizableHandle
The Separator (role separator, focusable, with aria-valuenow) between two panels; withHandle adds a visible grip; disabled stops resizing and leaves the tab order.

Keyboard & interaction

  • Drag the handle with a mouse, pen or finger; the library enlarges the hit area for coarse pointers (resizeTargetMinimumSize).
  • Focus the handle with Tab and use the arrow keys in its orientation to resize; Home and End jump to the limits (WAI-ARIA window splitter pattern).
  • Enter on the handle collapses a collapsible panel to its collapsedSize and restores it; a zero-size panel becomes inert so hidden controls leave the tab order.
  • Sizes respect minSize and maxSize; aria-valuenow on the separator reports the current split for assistive technology.
  • onLayoutChanged fires after a drag ends or a key press, with isUserInteraction, which is the right moment to persist the layout; groupRef.setLayout restores it.
  • A disabled handle ignores pointer and keyboard input and is skipped by Tab.

Responsive behavior

  • Below a breakpoint, replace the split with stacked panes or a single view with navigation; do not just hide the group with CSS on the Group element, whose inline display cannot be overridden (wrap it instead).
  • Prefer pixel minimums (numbers) for panes with fixed-width content such as navigation, and percentages for flexible content.
  • Keep the visible handle at least 24 CSS pixels in its long dimension and rely on the enlarged coarse-pointer hit area for touch.
  • Give the group a defined height in vertical orientation; otherwise panes collapse to their content.

Content guidelines

  • Name each handle by what it resizes: 'Resize sidebar', 'Resize output panel'.
  • Tell people the split is adjustable when it is not obvious, for example in a tooltip or onboarding hint, and how to reset it.
  • Keep pane content usable at its minimum size: wrap text, truncate labels with full text available, and let overflow scroll inside the pane.

Alternatives

  • Sidebar — Persistent app navigation with collapse behavior and a mobile sheet.
  • Sheet — A temporary side panel over the page, especially on small screens.
  • Collapsible — Hiding or revealing one region without a draggable boundary.

Resources