Resizable

Accessible resizable panels with drag handles for adjusting size.

layout
panels
resize
split

Preview

Sidebar
Content

Variants

Horizontal resizable panels with a drag handle.

Sidebar
Content

Code

TSX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import {
      ResizablePanel,
      ResizablePanelGroup,
      ResizableHandle,
    } from "@/components/ui/resizable"

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

API Reference

PropTypeDefaultDescription
directionhorizontal | verticalhorizontalThe axis the panels will resize on.
defaultSizenumber-The initial size of the panel in percentage.
minSizenumber10The minimum size of the panel in percentage.
maxSizenumber90The maximum size of the panel in percentage.
withHandlebooleanfalseWhether to show a visual drag handle on the resize handle.