Skip to content

shadcn.io is not affiliated with official shadcn/ui

Shadcn Resizable for React

Divides the interface into resizable sections.

One
Two
Three

Installation

bunx --bun shadcn@latest add https://kit.dev/r/base/resizable.json

Anatomy

Resizable
├── ResizablePanel
└── ResizableResizeTrigger
    └── ResizableResizeTriggerIndicator

Usage

import {
  Resizable,
  ResizablePanel,
  ResizableResizeTrigger,
} from "@/components/ui/resizable";
<Resizable
  className="max-w-sm rounded-lg border"
  defaultSize={[50, 50]}
  panels={[
    { id: "1", minSize: 10 },
    { id: "2", minSize: 10 },
  ]}
>
  <ResizablePanel id="1">
    <div className="flex h-[200px] items-center justify-center p-6">
      <span className="font-semibold">One</span>
    </div>
  </ResizablePanel>
  <ResizableResizeTrigger id="1:2" withHandle />
  <ResizablePanel id="2">
    <Resizable
      defaultSize={[25, 75]}
      orientation="vertical"
      panels={[
        { id: "3", minSize: 10 },
        { id: "4", minSize: 10 },
      ]}
    >
      <ResizablePanel id="3">
        <div className="flex h-full items-center justify-center p-6">
          <span className="font-semibold">Two</span>
        </div>
      </ResizablePanel>
      <ResizableResizeTrigger id="3:4" withHandle />
      <ResizablePanel id="4">
        <div className="flex h-full items-center justify-center p-6">
          <span className="font-semibold">Three</span>
        </div>
      </ResizablePanel>
    </Resizable>
  </ResizablePanel>
</Resizable>

Accessibility

KeyDescription
Enter
Activate the focused item.
ArrowUp
Move up.
ArrowDown
Move down.
ArrowLeft
Move left.
ArrowRight
Move right.
Home
Go to the start.
End
Go to the end.
F6
Handle the F6 key.

Demos

Vertical

Use orientation="vertical" for vertical resizing.

Handle

Use the withHandle prop on ResizableResizeTrigger to show a visible handle.

Rtl

Right-to-left resizable. See the RTL configuration guide for document direction.

API Reference

Resizable

PropType
AttributeType

ResizablePanel

PropType
AttributeType

ResizableResizeTrigger

PropType
AttributeType

ResizablePanelGroup

PropType

ResizableHandle

PropType