ToroUI

Resizable

Draggable panels that can be resized by the user, supporting both horizontal and vertical layouts.


A set of resizable panel components built on react-resizable-panels. Panels are arranged inside a group and separated by draggable handles that the user can grab to resize adjacent panels.

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

export default function ResizableDemo() {
  return (
    <ResizablePanelGroup orientation="horizontal" className="max-w-md rounded-lg border">
      <ResizablePanel defaultSize={50}>
        <div className="flex h-[200px] items-center justify-center p-6">
          <span className="font-semibold">One</span>
        </div>
      </ResizablePanel>
      <ResizableHandle withHandle />
      <ResizablePanel defaultSize={50}>
        <div className="flex h-[200px] items-center justify-center p-6">
          <span className="font-semibold">Two</span>
        </div>
      </ResizablePanel>
    </ResizablePanelGroup>
  )
}

Anatomy

import {
  ResizablePanelGroup,
  ResizablePanel,
  ResizableHandle,
} from "@/components/ui/resizable"
<ResizablePanelGroup direction="horizontal">
  <ResizablePanel>Panel A</ResizablePanel>
  <ResizableHandle />
  <ResizablePanel>Panel B</ResizablePanel>
</ResizablePanelGroup>

Examples

Horizontal layout

<ResizablePanelGroup direction="horizontal" className="min-h-[200px] max-w-md rounded-lg border">
  <ResizablePanel defaultSize={50}>
    <div className="flex h-full items-center justify-center p-6">
      <span className="font-semibold">Sidebar</span>
    </div>
  </ResizablePanel>
  <ResizableHandle />
  <ResizablePanel defaultSize={50}>
    <div className="flex h-full items-center justify-center p-6">
      <span className="font-semibold">Content</span>
    </div>
  </ResizablePanel>
</ResizablePanelGroup>

Vertical layout

<ResizablePanelGroup direction="vertical" className="min-h-[300px] max-w-md rounded-lg border">
  <ResizablePanel defaultSize={30}>
    <div className="flex h-full items-center justify-center p-6">
      <span className="font-semibold">Header</span>
    </div>
  </ResizablePanel>
  <ResizableHandle />
  <ResizablePanel defaultSize={70}>
    <div className="flex h-full items-center justify-center p-6">
      <span className="font-semibold">Body</span>
    </div>
  </ResizablePanel>
</ResizablePanelGroup>

With visible drag handle

Pass withHandle to render a visible grab indicator on the separator.

<ResizablePanelGroup direction="horizontal" className="min-h-[200px] max-w-md rounded-lg border">
  <ResizablePanel defaultSize={30} minSize={20}>
    <div className="flex h-full items-center justify-center p-6">
      <span className="font-semibold">Left</span>
    </div>
  </ResizablePanel>
  <ResizableHandle withHandle />
  <ResizablePanel defaultSize={70} minSize={30}>
    <div className="flex h-full items-center justify-center p-6">
      <span className="font-semibold">Right</span>
    </div>
  </ResizablePanel>
</ResizablePanelGroup>

Three-panel layout

<ResizablePanelGroup direction="horizontal" className="min-h-[200px] rounded-lg border">
  <ResizablePanel defaultSize={25} minSize={15}>
    <div className="flex h-full items-center justify-center p-6">Sidebar</div>
  </ResizablePanel>
  <ResizableHandle withHandle />
  <ResizablePanel defaultSize={50}>
    <div className="flex h-full items-center justify-center p-6">Main</div>
  </ResizablePanel>
  <ResizableHandle withHandle />
  <ResizablePanel defaultSize={25} minSize={15}>
    <div className="flex h-full items-center justify-center p-6">Inspector</div>
  </ResizablePanel>
</ResizablePanelGroup>

API Reference

ResizablePanelGroup

The container that holds panels and handles. Controls layout direction.

PropTypeDefaultDescription
direction"horizontal" | "vertical"The axis along which panels are arranged.
classNamestring
childrenReactNode

Accepts all props from react-resizable-panels Group.

ResizablePanel

A single panel that can be resized. Size is specified as a percentage of the group.

PropTypeDefaultDescription
defaultSizenumberInitial size as a percentage (0--100).
minSizenumberMinimum size as a percentage.
maxSizenumberMaximum size as a percentage.
collapsiblebooleanWhen true, the panel can be collapsed past its minimum size.
classNamestring
childrenReactNode

Accepts all props from react-resizable-panels Panel.

ResizableHandle

The draggable separator between two panels.

PropTypeDefaultDescription
withHandlebooleanWhen true, renders a visible grab indicator (a small rounded bar).
classNamestring

Accepts all props from react-resizable-panels Separator.