Resizable
Accessible panel groups separated by handles that spring thicker on fine-pointer hover, snap-collapse past minSize, and double-click reset to defaults.
Customize
Installation
npx shadcn@latest add @kinetic/resizableUsage
ResizablePanelGroup manages panel ratios using flexBasis percentages without external panel-layout dependencies. Handles respond to 1:1 pointer dragging, keyboard arrow keys (ArrowLeft/ArrowRight or ArrowUp/ArrowDown, Shift for larger jumps, Home/End, and Enter to toggle collapse), double-click reset, and spring-driven hover grip expansion.
import {
ResizableHandle,
ResizablePanel,
ResizablePanelGroup,
} from "@/components/kinetic/ui/resizable";
interface SplitWorkspaceProps {
readonly leftTitle: string;
readonly rightTitle: string;
}
export function SplitWorkspace({ leftTitle, rightTitle }: SplitWorkspaceProps) {
return (
<ResizablePanelGroup
direction="horizontal"
className="h-56 w-full rounded-lg border border-border"
>
<ResizablePanel defaultSize={35} minSize={20} collapsible>
<div className="flex h-full items-center justify-center p-4 text-sm font-medium">
{leftTitle}
</div>
</ResizablePanel>
<ResizableHandle withHandle />
<ResizablePanel defaultSize={65} minSize={30}>
<div className="flex h-full items-center justify-center p-4 text-sm text-muted-foreground">
{rightTitle}
</div>
</ResizablePanel>
</ResizablePanelGroup>
);
}API Reference
ResizablePanelGroup
Manages panel ratios, snap collapse thresholds, spring resets, and onLayout callbacks.
| Prop | Type | Default | Description |
|---|---|---|---|
direction / speed | "horizontal" | "vertical" / number | "horizontal" / 1 | Panel arrangement axis and spring playback speed multiplier. |
snapCollapseThreshold / onLayout | number / (sizes: readonly number[]) => void | 4 | Percent margin near minSize that snaps a collapsible panel shut on release. |
ResizablePanel
Percent-sized panel supporting minSize, maxSize, collapsible, collapsedSize, and collapse callbacks.
| Prop | Type | Default | Description |
|---|---|---|---|
minSize / maxSize | number / number | 10 / 100 | Percentage bounds enforced during drag and keyboard resizing. |
collapsible / collapsedSize | boolean / number | false / 0 | Allows snapping to collapsedSize when dragged past minSize or toggled with Enter. |
onResize / onCollapse / onExpand | callbacks | - | Fired when the panel percentage changes or crosses the collapsed boundary. |
ResizableHandle
Focusable WAI-ARIA separator with perpendicular aria-orientation, spring hover/drag thickness, double-click reset, and arrow key nudges.
| Prop | Type | Default | Description |
|---|---|---|---|
withHandle / disabled | boolean / boolean | false / false | Renders the centered grip pill or disables pointer and keyboard resizing. |