Resizable
Accessible resizable panel groups that allow users to drag dividers and customize layout proportions dynamically.
resizable.tsx
Resizable panel layouts powered by react-resizable-panels.
ReactTailwindUI ComponentLayoutResizable
"use client";
import * as React from "react";
import { Group, Panel, Separator } from "react-resizable-panels";
import { Icon } from "@iconify/react";
import { cn } from "@/lib/utils";
export interface ResizablePanelGroupProps extends Omit<React.ComponentProps<typeof Group>, "orientation"> {
direction?: "horizontal" | "vertical";
}
const ResizablePanelGroup = ({
className,
direction = "horizontal",
...props
}: ResizablePanelGroupProps) => (
<Group
orientation={direction}
className={cn(
"flex size-full data-[panel-group-direction=vertical]:flex-col",
className
)}
{...props}
/>
);
const ResizablePanel = Panel;
const ResizableHandle = ({
withHandle,
className,
...props
}: React.ComponentProps<typeof Separator> & {
withHandle?: boolean;
}) => (
<Separator
className={cn(
"relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",
className
)}
{...props}
>
{withHandle && (
<div className="z-10 flex h-4 w-3 items-center justify-center rounded-sm border border-border bg-background shadow-xs">
<Icon icon="hugeicons:drag-drop-vertical" className="size-2.5 text-muted-foreground" />
</div>
)}
</Separator>
);
export { ResizablePanelGroup, ResizablePanel, ResizableHandle };
Horizontal Layout
Side-by-side resizable panels with a visible handle.
direction:
horizontal | verticalwithHandle: booleanSidebar (30%)
Main Content (70%)
Nested Vertical Layout
Combine horizontal and vertical panel groups to compose complex IDE or dashboard workspaces.
File Explorer
Code Editor
Terminal Output
API Reference
Props — ResizablePanelGroup
Properties for configuring the ResizablePanelGroup container.
| Prop | Type | Default | Description |
|---|---|---|---|
| direction | 'horizontal' | 'vertical' | — | Axis layout direction for child panels and dividers. |
| withHandle | boolean | false | Renders an explicit drag icon handle inside ResizableHandle. |
| defaultSize | number | — | Initial size percentage allocated to ResizablePanel. |
| minSize | number | 0 | Minimum size percentage constraint for a panel. |