Resizable
Draggable split panes for code editors, file trees, and dashboard layouts — with the neobrutalist borders-and-shadows treatment.
import {
ResizableHandle,
ResizablePanel,The resizable component splits a region into panels the user drags to re-proportion — horizontal or vertical, nestable, with keyboard-operable handles. Both variants wrap react-resizable-panels by bvaughn, styled to the neobrutalist recipe: thick borders, hard shadows, and bold type.
Reach for it when:
- Code editors and IDE-style layouts — file tree, editor, and preview panes users size to taste.
- Master–detail views — inbox and thread, table and record inspector, with the divider where the user wants it.
- Dashboards and consoles — let a log pane or terminal steal height from the main view without a modal.
Installation#
pnpm dlx shadcn@latest add https://neobrutalism.com/r/base/resizable.jsonnpx shadcn@latest add https://neobrutalism.com/r/base/resizable.jsonyarn dlx shadcn@latest add https://neobrutalism.com/r/base/resizable.jsonbunx --bun shadcn@latest add https://neobrutalism.com/r/base/resizable.json
Install the following dependencies:
pnpm add react-resizable-panelsnpm install react-resizable-panelsyarn add react-resizable-panelsbun add react-resizable-panels
Copy and paste the following code into your project.
"use client"
import * as ResizablePrimitive from "react-resizable-panels"
import { cn } from "@/lib/utils"
function ResizablePanelGroup({
className,
...props
}: ResizablePrimitive.GroupProps) {
return (
<ResizablePrimitive.Group
data-slot="resizable-panel-group"
className={cn(
"flex h-full w-full aria-[orientation=vertical]:flex-col",
className
)}
{...props}
/>
)
}
function ResizablePanel({ ...props }: ResizablePrimitive.PanelProps) {
return <ResizablePrimitive.Panel data-slot="resizable-panel" {...props} />
}
function ResizableHandle({
withHandle,
className,
...props
}: ResizablePrimitive.SeparatorProps & {
withHandle?: boolean
}) {
return (
<ResizablePrimitive.Separator
data-slot="resizable-handle"
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-2 focus-visible:outline-offset-2 focus-visible:outline-primary aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90",
className
)}
{...props}
>
{withHandle && (
<div className="z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border" />
)}
</ResizablePrimitive.Separator>
)
}
export { ResizableHandle, ResizablePanel, ResizablePanelGroup }
Update the import paths to match your project setup.
Usage#
import {
ResizableHandle,
ResizablePanel,
ResizablePanelGroup,
} from "@/components/ui/resizable"<ResizablePanelGroup orientation="horizontal">
<ResizablePanel>One</ResizablePanel>
<ResizableHandle />
<ResizablePanel>Two</ResizablePanel>
</ResizablePanelGroup>Composition#
Use the following composition to build a ResizablePanelGroup:
ResizablePanelGroup
├── ResizablePanel
├── ResizableHandle
└── ResizablePanelExamples#
Vertical#
Use orientation="vertical" for vertical resizing.
import {
ResizableHandle,
ResizablePanel,Handle#
Use the withHandle prop on ResizableHandle to show a visible handle.
import {
ResizableHandle,
ResizablePanel,RTL#
To enable RTL support in Neobrutalism.com, see the RTL configuration guide.
"use client"
import * as React from "react"Accessibility#
The handle follows the WAI-ARIA Window Splitter pattern: react-resizable-panels renders each handle as a focusable role="separator" with aria-valuenow / aria-valuemin / aria-valuemax and aria-controls pointing at the panel it resizes, so screen readers announce the split position as it changes.
Keyboard interactions:
| Key | Action |
|---|---|
Tab / Shift + Tab | Move focus to / away from a resize handle |
ArrowLeft / ArrowRight | Resize a horizontal group by one step |
ArrowUp / ArrowDown | Resize a vertical group by one step |
Home | Shrink the panel before the handle to its minimum size |
End | Grow the panel before the handle to its maximum size |
Enter | Toggle a collapsible panel between collapsed and expanded |
API Reference#
See the react-resizable-panels documentation.
Changelog#
2025-02-02 react-resizable-panels v4#
Updated to react-resizable-panels v4. See the v4.0.0 release notes for full details.
If you're using react-resizable-panels primitives directly, note the following changes:
| v3 | v4 |
|---|---|
PanelGroup | Group |
PanelResizeHandle | Separator |
direction prop | orientation prop |
defaultSize={50} | defaultSize="50%" |
onLayout | onLayoutChange |
ImperativePanelHandle | PanelImperativeHandle |
ref prop on Panel | panelRef prop |
data-panel-group-direction | aria-orientation |
The Neobrutalism.com wrapper components (ResizablePanelGroup, ResizablePanel,
ResizableHandle) remain unchanged.