preskok/ui

Resizable

Draggable splitters for horizontal and vertical panel layouts.

Installation

pnpm dlx @preskok-org/ui@latest add resizable

Usage

import {
  ResizableHandle,
  ResizablePanel,
  ResizablePanelGroup,
} from "@/registry/preskok/ui/preskok-ui/resizable"
 
export function ResizableExample() {
  return (
    <ResizablePanelGroup
      direction="horizontal"
      className="min-h-[200px] max-w-md rounded-lg border"
    >
      <ResizablePanel defaultSize={50} minSize={25}>
        <div className="flex h-full items-center justify-center p-4">One</div>
      </ResizablePanel>
      <ResizableHandle withHandle />
      <ResizablePanel defaultSize={50} minSize={25}>
        <div className="flex h-full items-center justify-center p-4">Two</div>
      </ResizablePanel>
    </ResizablePanelGroup>
  )
}

Panels are powered by react-resizable-panels. Use direction on ResizablePanelGroup, optional withHandle on ResizableHandle for the grip affordance, and defaultSize / minSize on each ResizablePanel as needed.