Skip to content
Ballpoint

Resizable

Panels side by side or one above another with a pen line between each pair to drag. Arrow keys work too. No library.

From shadcn/ui
One
Two

Installation

pnpm dlx shadcn@latest add @ballpoint/resizable

Usage

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

<ResizablePanelGroup direction="horizontal">
  <ResizablePanel defaultSize={50}>One</ResizablePanel>
  <ResizableHandle />
  <ResizablePanel defaultSize={50}>Two</ResizablePanel>
</ResizablePanelGroup>

Examples

Vertical

Panels one above another.

Header
Content

With a grip

A boxed grip on the handle, and a group nested inside a panel.

Pages
Canvas
Notes

API reference

ResizablePanelGroup direction
default "horizontal"
"horizontal" | "vertical"

Which way the panels run. Give the group a height.

ResizablePanelGroup framed
default false
boolean

Pencils a box round the whole group.

ResizablePanelGroup onLayout
(sizes: number[]) => void

Called with every panel's size, as percentages, as a handle moves.

ResizablePanel defaultSize / minSize / maxSize
number

Percentages of the group. Panels without a defaultSize share what's left.

ResizableHandle withHandle
default false
boolean

Adds a boxed grip on the line.

ResizableHandle keys
Arrow keys, Shift, Home, End

Focus the handle: arrows move it 2%, with Shift 10%; Home and End send it as far as the panels allow.

seed
string | number

Pins the drawing.

Pen settings

The drawing also takes draw, roughness, weight and speed, as props or from the nearest InkProvider. What each one does.