Components

Resizable

Resizable React panels built on shadcn/ui and react-resizable-panels v4: drag or keyboard-resize split views with a handle that turns mint while you drag it, plus an IDE-style layout block with a collapsible sidebar that tweens into an icon rail.

  • Drop-in shadcn API
  • react-resizable-panels v4
  • Keyboard resizing
  • Collapsible panels
  • Clear drag state
Explorer
page.tsx
1import { Hero } from "@/components/hero"
2
3export default function Page() {
4 return <Hero title="Ship at dusk" />
5}
Terminal
➜ npm run dev
  ▲ Next.js ready on http://localhost:3000
  ✓ Compiled in 412ms

Installation

$ npx shadcn@latest add https://duskui.com/r/resizable.json

Adds components/ui/resizable.tsx for react-resizable-panels v4. In v4 numeric sizes are pixels and strings without a unit are percentages, so write defaultSize="25" for a quarter. The group prop is orientation; the v2 direction prop is still accepted.

Usage

split-view.tsx
import {
  ResizableHandle,
  ResizablePanel,
  ResizablePanelGroup,
} from "@/components/ui/resizable"

export function SplitView() {
  return (
    <ResizablePanelGroup orientation="horizontal" className="rounded-xl border">
      <ResizablePanel defaultSize="30" minSize={180}>Sidebar</ResizablePanel>
      <ResizableHandle withHandle />
      <ResizablePanel>Content</ResizablePanel>
    </ResizablePanelGroup>
  )
}

Examples

Default

A horizontal group with a nested vertical group. The line brightens on hover; while you drag (or while the handle has keyboard focus) it turns mint and the grip pill gets a mint border.

One
Two
Three

Vertical with live sizes

orientation="vertical" stacks panels. onLayoutChange reports a map of panel id to percentage on every move — use onLayoutChanged to persist only after the pointer is released.

## Release notes- Drag the divider, or focus it and press ↑ / ↓.- Home and End jump to the limits.
Preview

Preview: 35%

Blocks

Ready-made variations composed from the base component with Motion. Each installs on its own and pulls in its dependencies automatically.

Resizable Layout

An IDE-style shell: a collapsible sidebar, a main area and an optional bottom panel. Drag the sidebar below its minimum and it snaps into an icon rail; the toggle button (or useResizableLayout().toggle) collapses and expands it with a 320 ms tween that only runs for the toggle, so dragging stays one-to-one. Pass sidebar as a function to render a different layout when collapsed.

Explorer
page.tsx
1import { Hero } from "@/components/hero"
2
3export default function Page() {
4 return <Hero title="Ship at dusk" />
5}
Terminal
➜ npm run dev
  ▲ Next.js ready on http://localhost:3000
  ✓ Compiled in 412ms
$ npx shadcn@latest add https://duskui.com/r/resizable-layout.json
PropTypeDefaultDescription
sidebarReactNode | ({ collapsed }) => ReactNode—Sidebar contents; the function form can render an icon rail.
childrenReactNode—The main area.
bottomReactNode—Optional bottom panel under the main area (collapsible by dragging).
sidebarDefaultSizenumber | string"24"Initial sidebar size. Numbers are px, unitless strings are %.
sidebarMinSize / sidebarMaxSizenumber | string180 / "40"Limits while open; dragging below the minimum collapses it.
collapsedSizenumber | string52Width of the collapsed rail. 0 hides the sidebar.
defaultCollapsed / onCollapsedChangeboolean / (collapsed) => voidfalseInitial state and change callback.
sidebarLabelstring"Sidebar"Accessible name of the sidebar region and its resize handle.
ResizableLayoutTogglebutton props—Toggle button with aria-expanded / aria-controls wired up.

API Reference

Same parts as shadcn/ui: ResizablePanelGroup (v4 Group), ResizablePanel (Panel) and ResizableHandle (Separator), each forwarding the react-resizable-panels v4 props.

PropTypeDefaultDescription
orientation"horizontal" | "vertical""horizontal"On ResizablePanelGroup. `direction` is accepted as an alias.
defaultLayout / onLayoutChange / onLayoutChangedRecord<string, number>—On ResizablePanelGroup: initial and reported layouts, keyed by panel id.
groupRefRef<GroupImperativeHandle>—On ResizablePanelGroup: getLayout() / setLayout().
defaultSize / minSize / maxSizenumber | string—On ResizablePanel. Numbers are px; "25" or "25%" are percentages; rem / vh work too.
collapsible / collapsedSizeboolean / number | stringfalse / "0%"On ResizablePanel: snap shut below minSize.
panelRefRef<PanelImperativeHandle>—On ResizablePanel: collapse(), expand(), resize(), getSize(), isCollapsed().
withHandlebooleanfalseOn ResizableHandle: show the grip pill.
disabledbooleanfalseOn the group, a panel or a handle.

Accessibility

  • Each ResizableHandle is a focusable role="separator" with aria-valuenow / min / max and aria-controls, maintained by react-resizable-panels.
  • Arrow keys resize from the focused handle; Home and End jump to the limits. Focus shows the same mint line as dragging.
  • Give handles an aria-label ("Resize sidebar") when there are several; the layout block labels its sidebar region and handle for you.
  • The sidebar toggle exposes aria-expanded and aria-controls; under prefers-reduced-motion it snaps instead of tweening.